How to handle spaces in DataTrigger binding for WPF DataGrid?
I am using autogenerating datagrid and bind it to DataTable. This DataTable has columns with spaces of type "Last Value". Now I need to add a datatrigger to apply some style as shown below:
<DataGrid.Resources>
<Style x:Key="DgStyle" TargetType="{x:Type TextBlock}">
<Setter Property="TextAlignment" Value="Right"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Last Value, Converter= {StaticResource DecimalToBoolConverter}}" Value="True">
<Setter Property="Foreground" Value="Red" />
</DataTrigger>
</Style.Triggers>
</Style>
</DataGrid.Resources>
But the DataTrigger Binding doesn't support spaces (last value). When I remove the space (LastValue) then it works fine. But as per my requirement I need a space in the name of the data columns and this table is used to bind the datagrid.
How can I handle this scenario? Please suggest.
+1
source to share