Can anyone tell me what is the c# equivalent of the following snippet of XAML ??
<my:DataGridTextColumn
Visibility="{Binding Path=DataColumns[21].IsVisible, Source={StaticResource viewmodel}, Converter={StaticResource vc}}"
Binding="{Binding SdDevDuration}"
/>
Its the visibility binding I cannot get right. DataGridTextColumn is not a FrameworkElement so no SetBinding method.
Thanks in advance,
Matt
I worked this out. For anyone who's interested you can use the BindingOperation.SetBinding method.
The full code is,
var newCol = new DataGridTextColumn();
newCol.Binding = new Binding("SdDevDuration");
var visiblityBinding = new Binding("IsVisible");
visiblityBinding.Source = col;
visiblityBinding.Converter = new VisibilityConverter();
BindingOperations.SetBinding(newCol, DataGridTextColumn.VisibilityProperty, visiblityBinding);
I set the Visibility's Source to a StaticResource, but still got AG_E_BAD_PARSER runtime error, looks like it works in WPF but not in Silverlight. I'm using Silverlight 3 DataGridTextColumn. have you tried this in Silverlight?
I found another link related to this issue, but I haven't found the solution yet. Silverlight DataGridTextColumn Binding Visibility
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.