Hi all
I have tried all sorts of ways (BindingProxy, Converters, DP Helpers..) but I can't seem to get it to work.
I have this:
<telerik:GridViewDataColumn
Header="Unit Cost"
DataMemberBinding="{Binding UnitCost}"
Style="{StaticResource Style.GridViewDataColumn.Currency}"
Width="120" />
And the style (simplified) is this:
<Style
x:Key="Style.GridViewDataColumn.Currency"
TargetType="{x:Type telerik:GridViewDataColumn}">
<Setter
Property="DataFormatString"
Value="N2" />
<!-- Cell Template (Display Mode) -->
<Setter
Property="CellTemplate">
<Setter.Value>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition
Width="Auto" />
<ColumnDefinition
Width="*" />
</Grid.ColumnDefinitions>
<TextBlock
Text="$"
VerticalAlignment="Center"
Margin="5,0" />
<TextBlock
Text="{Binding ??, StringFormat=N2}"
VerticalAlignment="Center"
HorizontalAlignment="Right"
Grid.Column="1" />
</Grid>
</DataTemplate>
</Setter.Value>
</Setter>
<!-- Cell Edit Template -->
<Setter
Property="CellEditTemplate">
<Setter.Value>
<DataTemplate>
<telerik:RadMaskedCurrencyInput
Value="{Binding Path=??, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
IsTabStop="True" />
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
How can I define the Path generically. If I hard code UnitCost it works, but I need it to be generic, and I can't find a way to do it.
PS: Design breif is that our company wants to display the $ sign on the left and the value aligned right.
Any insight would be welcomed greatly.
I have tried all sorts of ways (BindingProxy, Converters, DP Helpers..) but I can't seem to get it to work.
I have this:
<telerik:GridViewDataColumn
Header="Unit Cost"
DataMemberBinding="{Binding UnitCost}"
Style="{StaticResource Style.GridViewDataColumn.Currency}"
Width="120" />
And the style (simplified) is this:
<Style
x:Key="Style.GridViewDataColumn.Currency"
TargetType="{x:Type telerik:GridViewDataColumn}">
<Setter
Property="DataFormatString"
Value="N2" />
<!-- Cell Template (Display Mode) -->
<Setter
Property="CellTemplate">
<Setter.Value>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition
Width="Auto" />
<ColumnDefinition
Width="*" />
</Grid.ColumnDefinitions>
<TextBlock
Text="$"
VerticalAlignment="Center"
Margin="5,0" />
<TextBlock
Text="{Binding ??, StringFormat=N2}"
VerticalAlignment="Center"
HorizontalAlignment="Right"
Grid.Column="1" />
</Grid>
</DataTemplate>
</Setter.Value>
</Setter>
<!-- Cell Edit Template -->
<Setter
Property="CellEditTemplate">
<Setter.Value>
<DataTemplate>
<telerik:RadMaskedCurrencyInput
Value="{Binding Path=??, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
IsTabStop="True" />
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
How can I define the Path generically. If I hard code UnitCost it works, but I need it to be generic, and I can't find a way to do it.
PS: Design breif is that our company wants to display the $ sign on the left and the value aligned right.
Any insight would be welcomed greatly.