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
  • 138253
    Offline posted

    Hello Pranzo,

    Thank you for your post. I have been looking through it and I attached a sample project which shows the DataBinding. It also shows how to hide a Field in the Loaded Event of the xamDataGrid. If you still cannot achieve your goal I will be glad if you send me your sample, so I can make a further investigation on your issue.

    Looking forward for your reply.

    DataContextSample.zip
Reply Children