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.
attached the example with the error
If I do everything only with Windows gives me error:
only: this.DataContext = col; / / This for all
Binding xamDataGrid_Loaded me error in the method.
thanks
Hello again,
I have been looking through your post and I suggest you set the DataContext only for the Window, because it is applied through the visual tree to all its children.
Looking forward for your reply.
Thanks Stefan for the example.The problem is that I have to make the DataContext to Windows and not the xamDataGrid1to bind other controls.In the example I set, I solved it:Window I put in the load:this.DataContext = col; / / This for the textBox BindingxamDataGrid1.DataContext = col; / / This for xamDataGrid.Thank you.
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.