Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
255
XamlGrid wcf ria services propertychanged event fires only once.
posted

I have a checkbox column that when checked / unchecked, causes the propertychanged event on the datasource to only fire once. If I submit the changes, then the event will fire again, but only once.

Am I missing something or shouldn't the event fire everytime a checkbox is checked/unchecked in the grid? Below is the event handler that I set up on the datasource's propertychanged event as well as the event declaration.

public MainPage()
{
  InitializeComponent();
  context.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(context_PropertyChanged);
}

void context_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
    if (!context.IsLoading && !context.IsSubmitting && e.PropertyName.Equals("HasChanges"))
    {
        Row r = gridForecastSchedule.Rows[0];
        if (r != null)
        {
            HeaderCellControl hcc = (HeaderCellControl)((RowsManager)r.Manager).HeaderRow.Cells["Suppress"].Control;
            if (hcc != null)
            {
                CheckBox headerCB = hcc.Content as CheckBox;
                if (headerCB != null)
                {
                    headerCB.Checked -= All_Checked;
                    headerCB.Unchecked -= All_Checked;
                    headerCB.IsChecked = (context.ForecastScheduleWorkModels.Count() > 0 && context.ForecastScheduleWorkModels.Where(a => a.Suppress.Equals(false)).Count() == 0);
                    headerCB.Checked += new RoutedEventHandler(All_Checked);
                    headerCB.Unchecked += new RoutedEventHandler(All_Checked);
                }
            }
        }
    }

    if (context.HasChanges && (!context.IsLoading && !context.IsSubmitting))
        btnSave.IsEnabled = true;
    else
        btnSave.IsEnabled = false;

    if (context.IsSubmitting)
    {
        busyDialog.IsBusy = true;
    }
}

Parents
No Data
Reply
  • 12875
    posted

    Hi,

    I’m not sure I understand your application design. 

     

    I gather that you are asking if the “context” propertyChanged event would fire when the checkbox is checked and unchecked.  But I am not clear about what is the “context”.  Is that your grid’s datasource?  Is the checkbox bound to your datasource?  

     

    Please attach a small sample that duplicates this behavior using Northwind so that I can investigate your implementation.

     

Children