Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4611350
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:15:22+00:00 2026-05-22T01:15:22+00:00

I have following class as the main window: public partial class Window1 : Window

  • 0

I have following class as the main window:

public partial class Window1 : Window
{
    public Network network { get; set; }
    public DataSet data_set { get; set; }
    public Training training { get; set; }

    public string CurrentFile { get; set; }

    public MGTester tester;
    public MCTester testerSSE;

    public ChartWindow ErrorWindow;
    public ChartWindow TimesWindow;

    public Window1()
    {
        network = new Network();
        data_set = new DataSet();
        training = new Training();
        tester = new MGTester();
        testerSSE = new MCTester();
        CurrentFile = "";
        ErrorWindow = new ChartWindow();
        TimesWindow = new ChartWindow();

        InitializeComponent();

        for (int i = 0; i < tester.GetDeviceCount(); ++i)
        {
            DeviceComboBox.Items.Add(tester.GetDeviceName(i));
        }
    }...

And in my xaml code I have:

<ListView Grid.Row="0" x:Name="NetworkListview" ItemsSource="{Binding network.Layers}" IsSynchronizedWithCurrentItem="True">
                    <ListView.View>
                        <GridView>
                            <GridViewColumn Width="100" Header="layer name" DisplayMemberBinding="{Binding Name}"/>
                            <GridViewColumn Width="60" Header="neurons" CellTemplate="{StaticResource NeuronsTemplate}"/>
                            <GridViewColumn Width="110" Header="activation" CellTemplate="{StaticResource ActivationTemplate}"/>
                        </GridView>
                    </ListView.View>
                </ListView>

Anyway I am binding to some member of Window1…
And it works fine but I want to change the member that controlls are binded to –
I mean I want to do somthing like that in Window1

this.network = new Network();

When I do this binding stops working – How I can easily and nicely just “refresh” the binding?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T01:15:23+00:00Added an answer on May 22, 2026 at 1:15 am

    If your binding source is not a UI-class, use a notifying property instead of an auto one.

    http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged.aspx

    public class MyClass : INotifyPropertyChanged
    {
        private Network _network;
    
        public Network Network
        {
            get
            {
                return _network;
            }
            set
            {
                if (value != _network)
                {
                    _network = value;
                    NotifyPropertyChanged(value);
                }
            }
        }
    
    
        protected NotifyPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
    
    }
    

    If your source class is a UI-class, define Network to be a DependencyProperty:

    http://msdn.microsoft.com/en-us/library/system.windows.dependencyproperty.aspx

    Example quoted from above link:

    public class MyStateControl : ButtonBase
    {
      public MyStateControl() : base() { }
      public Boolean State
      {
        get { return (Boolean)this.GetValue(StateProperty); }
        set { this.SetValue(StateProperty, value); } 
      }
      public static readonly DependencyProperty StateProperty = DependencyProperty.Register(
        "State", typeof(Boolean), typeof(MyStateControl),new PropertyMetadata(false));
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following class public class Car { public Name {get; set;} }
I have the following code: public class Test { public static void Main() {
I have the following class: public abstract class AbstractParent { static String method() {
Have following code: public interface ITest { string St1 { get; } } public
I have a main window with following code: <Window x:Class=CAMXSimulator.MainWindow xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml xmlns:View=clr-namespace:CAMXSimulator.View xmlns:ViewModel=clr-namespace:CAMXSimulator.ViewModel
I have the following class [XmlRoot(ElementName= webSites)] //No capital w at the beginning public
I have the following class objects: public class VacancyCategory { public int ID {
Say I have the following class MyComponent : IMyComponent { public MyComponent(int start_at) {...}
Using: C#, VS2008 I have the following main form class: [Main.cs] namespace Server {
I have a WPF application with the main Window class called MainWindow. Since I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.