wpfmvvmxceedxceed-datagrid

How to add a binding to UIElement's property, without SetBinding() method?


I'm asking about Column object - DataGridControl from Xceed's WPF Extended Toolkit. I need to create a Column in code, and add a binding to its Width property. Column class doesn't expose the SetBinding() method. Although in XAML - it supports bindings as usual:

<xcdg:Column Width="{Binding Path=ColWidth}">

Is there a way to make such binding to some ViewModel's property? Or a walkaround, possibly, to apply some Style or Template (static? created in code?) that would have a binding?


Solution

  • Use BindingOperations.SetBinding, it's the method that should be used internally by FrameworkElement.SetBinding.