我有一个转换器,可以将 Double.Nan
转换为 null
。我需要在资源字典中引用它。
以下是我的代码:
<Style x:Key="LabelStyle" TargetType="{x:Type Label}" >
<Setter Property="Content">
<Setter.Value>
<Binding Path="Content" RelativeSource="{RelativeSource Self}">
<Binding.Converter>
<local:NanToNullConverter/>
</Binding.Converter>
</Binding>
</Setter.Value>
</Setter>
</Style>
这个转换器已被触发。但是界面上的数值没有更新。 绑定方式如下:
<Label Style="{DynamicResource LabelStyle}" Content="{Binding Filters_TanksModelObject.RunDown_HeaderPressureDischargeStart ,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" ContentStringFormat="#.##" ></Label>