Hi
If there is an validation error on the editable cell, I set a style, in code, for that cell like so:-
now I know this style is awful, but it is the principle I am after.
When I set this style in code, the entire grid cells are no longer editable, also, if I scroll the grid so the offending cell is out of view, then scroll it back into view, the style has disappeared.
Any thoughts why this is happening?
Thanks
P
If there is an validation error on the editable cell, I set a style, in code, for that cell like so:-
| Private Sub gv1_PreviewValidate(ByVal sender As System.Object, ByVal e As Telerik.Windows.Controls.GridView.Cells.CellValidatingRoutedEventArgs) |
| If e.NewValue = String.Empty Then |
| e.ValidationResult = New Telerik.Windows.Controls.GridView.ValidationResult(False, Nothing) |
| DirectCast(DirectCast(e.OriginalSource, System.Object), Telerik.Windows.Controls.GridView.GridViewCell).Style = Me.FindResource("ContentControlStyleError") |
| Else |
| e.ValidationResult = New Telerik.Windows.Controls.GridView.ValidationResult(True, Nothing) |
| DirectCast(DirectCast(e.OriginalSource, System.Object), Telerik.Windows.Controls.GridView.GridViewCell).Style = Nothing |
| End If |
and the style is
| <Style x:Key="ContentControlStyleError" TargetType="{x:Type telerik:GridViewCell}"> |
| <Setter Property="Template"> |
| <Setter.Value> |
| <ControlTemplate TargetType="{x:Type ContentControl}"> |
| <Border Width="110" Height="55" BorderThickness="2,2,2,2" CornerRadius="10,10,10,10" BorderBrush="#FF000000" RenderTransformOrigin="0.5,0.5"> |
| <Border.RenderTransform> |
| <TransformGroup> |
| <ScaleTransform ScaleX="1" ScaleY="1"/> |
| <SkewTransform AngleX="0" AngleY="0"/> |
| <RotateTransform Angle="17.431"/> |
| <TranslateTransform X="0" Y="0"/> |
| </TransformGroup> |
| </Border.RenderTransform> |
| <Border.Background> |
| <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> |
| <GradientStop Color="#FF000000" Offset="0"/> |
| <GradientStop Color="#FFDC1D1D" Offset="1"/> |
| </LinearGradientBrush> |
| </Border.Background> |
| <ContentPresenter |
| VerticalAlignment="Center" |
| HorizontalAlignment="Right" |
| Margin="0,0,10,0" |
| TextBlock.Foreground="White" /> |
| </Border> |
| </ControlTemplate> |
| </Setter.Value> |
| </Setter> |
| </Style> |
When I set this style in code, the entire grid cells are no longer editable, also, if I scroll the grid so the offending cell is out of view, then scroll it back into view, the style has disappeared.
Any thoughts why this is happening?
Thanks
P