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 關注
- 317 瀏覽
添加回答
舉報