Hello,
i have a controltemplate for GridViewCell and I'm having some problems with its binding.
First of all when i used: (the column is binded to Price)
The value disapears from the cell when the row is selected.
Then i tried:
but this way the value in the source object is not updated. the setter is called with the old value
can you tell what I'm doing wrong?
my controlTemplate looks like this:
Thanks!
i have a controltemplate for GridViewCell and I'm having some problems with its binding.
First of all when i used: (the column is binded to Price)
Text="{Binding Path=Content.Field.Value}" |
Then i tried:
Text="{Binding Path=DataContext.Price, Mode=TwoWay, Converter = {StaticResource CentPriceConverter}, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:GridViewRow}}}" |
can you tell what I'm doing wrong?
my controlTemplate looks like this:
<ControlTemplate x:Key="PriceExpandedCell" TargetType="telerik:GridViewCell"> |
<Border Name="Part_Border" |
CornerRadius="0" |
Loaded="Part_Border_Loaded" |
Height="Auto" |
BorderBrush="{StaticResource SolidBorderBrush}" |
VerticalAlignment="Stretch"> |
<StackPanel Name="Part_StackPanel" |
ScrollViewer.VerticalScrollBarVisibility="Hidden" |
Orientation="Vertical" |
Background="{Binding Path=Background, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:GridViewRow}}}"> |
<TextBox Name="Part_Text" |
Width="Auto" |
BorderThickness="0" |
Background="Transparent" |
Margin="2,2,2,2" |
TextChanged="Part_Text_TextChanged" |
Foreground="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:GridViewRow}}}" |
Text="{Binding Path=DataContext.Price, Mode=TwoWay, Converter = {StaticResource CentPriceConverter}, |
RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:GridViewRow}}}"/> |
<Button Content="Discount" Margin="15,3,3,3" |
Name="btnDiscount" |
Click="btnDiscount_Click" |
HorizontalAlignment="Left" |
Style="{StaticResource CompactButton}"/> |
</StackPanel> |
</Border> |
<ControlTemplate.Triggers> |
<DataTrigger Binding="{Binding Path=IsSelected, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:GridViewRow}}}" Value="True"> |
<Setter TargetName="Part_StackPanel" Property="Background" Value="{StaticResource HighlightGradientBrush}"/> |
</DataTrigger> |
<Trigger Property="IsInEditMode" Value="True"> |
<Setter TargetName="Part_Border" Property="BorderThickness" Value="3"/> |
<Setter TargetName="Part_StackPanel" Property="Background" Value="{StaticResource LightBlueBrush}"/> |
</Trigger> |
</ControlTemplate.Triggers> |
</ControlTemplate> |
Thanks!