1 回答
TA贡献1797条经验 获得超6个赞
默认情况下ADataGridColumn
不会继承任何内容DataContext
,因此您的绑定会失败,这就是转换器从未被调用的原因。这与 ReactiveUI 无关。
public class BindingProxy : Freezable
{
protected override Freezable CreateInstanceCore()
{
return new BindingProxy();
}
public object Data
{
get { return (object)GetValue(DataProperty); }
set { SetValue(DataProperty, value); }
}
public static readonly DependencyProperty DataProperty =
DependencyProperty.Register("Data", typeof(object), typeof(BindingProxy), new UIPropertyMetadata(null));
}
XAML:
<DataGrid.Resources>
<local:BindingProxy x:Key="proxy" Data="{Binding}" />
</DataGrid.Resources>
...
<DataGridTextColumn Header="Backpay Cat." Binding="{Binding Price}"
Visibility="{Binding Data.BackPayCategoryVisible,
Converter={StaticResource Conv},
Source={StaticResource proxy}}"/>
- 1 回答
- 0 关注
- 221 浏览
添加回答
举报