This is a migrated thread and some comments may be shown as answers.

How set GridViewCell BorderBrush property in programme.

0 Answers 138 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Lior asked on 05 Nov 2012, 08:54 AM
we face an issue that it's no use to set the GridViewCell.BorderBrushProperty in Styleselector.
but the "BackgroundProperty" is working, why, Any workaround?
style = new Style(typeof(GridViewCell));
                   Setter setterBackground = new Setter();
                   setterBackground.Property = GridViewCell.BackgroundProperty;
                   setterBackground.Value = new SolidColorBrush(Colors.Black);
                   Setter setterBorder = new Setter();
                   setterBorder.Property = GridViewCell.BorderBrushProperty;
                   setterBorder.Value = new SolidColorBrush(Colors.Red);
                   Setter setterBorderThickness = new Setter();
                   setterBorderThickness.Property = GridViewCell.BorderThicknessProperty;
                   setterBorderThickness.Value = "2,2,2,2";

The Cell Background is working but there is no response for BorderBrushProperty 

We let the style in the resource  hasving the border in control template and another setter :  Backgroupd is yellow
<Style x:Key="CellLv1Validation"   TargetType="telerik:GridViewCell">
        <Setter Property="Background" Value="Yellow"/>
         <Setter Property="Template">
            <ControlTemplate TargetType="telerik:GridViewCell">
              <Border x:Name="PART_CellBorder" BorderBrush="Red" BorderThickness="2"/>

Cs file
Uri uri = new Uri("/Soluntion.X;component/Assets/ApplicationStyles.xaml", UriKind.RelativeOrAbsolute);
ResourceDictionary converterDictionary = new ResourceDictionary()
    Source = uri
style = converterDictionary["CellLv1Validation"] as Style;

A strange thing is after style change, the border become red ,the orginal text value disapper and background is not working to yellow background

Hey, dear telerikers plz help or glace at this issue? thank you in advance.

No answers yet. Maybe you can help?

Asked by
Top achievements
Rank 1
Share this question