0
votes

My WPF-application has a window with third-party control in witch loading data. Control has methods for show and hide progress bar when data begin loading and end. I use MVVM for data binding to my controls. I need property witch indicate when data loading begin and end and this property must be accessible in code behind. I added CheckBox control in window with Visibility="Hidden" and bind it to property flag in my ViewModel, also added EventHandler on Checked event:

<CheckBox Name="chkIndicator" Visibility="Hidden" IsChecked="{Binding IsDataLoading}" Checked="chkIndicator_Checked" />

In code behind view event handler:

private void chkIndicator_Checked(object sender, RoutedEventArgs e)
{
    if(this.chkIndicator.IsChecked.Value)
        tableViewOrders.ShowIndicator();
    else 
        tableViewOrders.HideIndicator();
}

In ViewModel when loading data:

public bool IsDataLoading
{
    get { return _isDataLoading;}
    set {
        _isDataLoading = value;
        PropertyChanged("IsDataLoading");
    }
}
...
public void MethodLoadingData()
{
    /*1*/ IsDataLoading = true;

    //here method for loading data to collection binded to tableViewOrders

    /*2*/ IsDataLoading = false;
}

When method MethodLoadingData execute, line /1/ is work fine - eventhandler chkIndicator_Checked fired, but when /2/ run - eventhandler doesn't fire. Any ideas where I'm wrong?

1

1 Answers

0
votes

Did you tried changing the binding mode of "IsChecked" property to two way or something