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
830
Hiding column with Binding DataContext
posted

Good morning.

In a XDataGrid I load in the Load Window like this:
this.xdgBase.DataSource = mDtSoggetti.DefaultView;
xdgBase_Loaded use the event to hide columns in the DataGrid:
     private void xdgBase_Loaded (object sender, RoutedEventArgs e)
         {
                 FieldLengthConverter converter1 FieldLengthConverter = new ();
                 XamDataGrid xdg = sender as XamDataGrid;
                 xdg.FieldLayouts [0]. Fields ["IDSoggetto"]. System.Windows.Visibility.Hidden = Visibility;
         }

If instead of loading the XdataGrid via code, I do it by setting the bindings in XAML (igDP: XamDataGrid Grid.Row = "1" DataSource = "{Binding}") and put in the load:
this.DataContext = mDtSoggetti;
gives me error can not find the fileds ["IDSoggetto"].

Which method should I use instead of xdgBase_Loaded?

Thank you.

Parents Reply Children
No Data