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

How set GridViewCell BorderBrush property in programme.

0 Answers 59 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Lior
Top achievements
Rank 1
Lior asked on 05 Nov 2012, 08:54 AM
Hi,
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);
                   style.Setters.Add(setterBackground);
 
                   Setter setterBorder = new Setter();
                   setterBorder.Property = GridViewCell.BorderBrushProperty;
                   setterBorder.Value = new SolidColorBrush(Colors.Red);
                   style.Setters.Add(setterBorder);
 
                   Setter setterBorderThickness = new Setter();
                   setterBorderThickness.Property = GridViewCell.BorderThicknessProperty;
                   setterBorderThickness.Value = "2,2,2,2";
 
                   style.Setters.Add(setterBorderThickness);

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

Update:
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">
           <Setter.Value>
            <ControlTemplate TargetType="telerik:GridViewCell">
              <Border x:Name="PART_CellBorder" BorderBrush="Red" BorderThickness="2"/>
               
              </ControlTemplate>
           </Setter.Value>
        </Setter>
    </Style>

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?

Tags
GridView
Asked by
Lior
Top achievements
Rank 1
Share this question
or