I have a converter to convert Double.Nan to null.
I need to refer this in resourcedictionary.
I will include my code here
<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>
This convereter is triggered. But value is not updating in the UI. Binding is done like this
<Label Style="{DynamicResource LabelStyle}" Content="{Binding Filters_TanksModelObject.RunDown_HeaderPressureDischargeStart ,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" ContentStringFormat="#.##" ></Label>
Local properties are preferred over style properties, so your <Setter Property="Content"> is ignored and only the Content="{Binding Filters_TanksModelObject.RunDown_HeaderPressureDischargeStart ,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" is used.
Instead, use
<Style x:Key="LabelStyle" TargetType="{x:Type Label}" >
<Setter Property="Content">
<Setter.Value>
<Binding Path="Filters_TanksModelObject.RunDown_HeaderPressureDischargeStart" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged">
<Binding.Converter>
<local:NanToNullConverter/>
</Binding.Converter>
</Binding>
</Setter.Value>
</Setter>
</Style>
and remove the direct assignment. Or use this binding directly and don't rely on the style.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With