How can I bind field.Visibility property to the data in my business object, and do it in code-behind?
This blog
http://blogs.infragistics.com/blogs/josh_smith/archive/2008/06/06/binding-a-xamdatagrid-field-property.aspx
explains how to acheive it in xaml, but i'm looking for a way to implement the binding in code-behind.
Hello,
You can try to use the BindingOperations.SetBinding method in codebehind e.g.
Field firstField = xamDataGrid1.FieldLayouts[0].Fields[0];
Binding bin = new Binding();bin.Converter = new BooleanToVisibilityConverter();bin.Source = viewmodel;bin.Path = new PropertyPath("IsVisible");
BindingOperations.SetBinding(firstField, Field.VisibilityProperty, bin);
I hope this helps
Vlad