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

[Solved] Column Borders

6 Answers 169 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Charles Nelson
Top achievements
Rank 1
Charles Nelson asked on 17 Sep 2010, 06:16 PM
I am trying to apply specific border thicknesses to specific column borders in the radgrid.  Can anyone help me accomplish this.  I used  a style with contentpresenter but I am guessing since it is a presenter, Edit function is not available. So this means that it displays the data but i am unable to enter edit mode for the GridviewCell where the new style is applied.  here is the code below.

                    <g:GridViewDataColumn DataMemberBinding="{Binding Traditional_Governance_Concerns, Mode=TwoWay}"  Header="Traditional Governance Concerns" HeaderCellStyle="{StaticResource OveralWeightingCellStyle}">
                        <g:GridViewDataColumn.CellStyle>
                            
                            <Style TargetType="telerik:GridViewCell">
                                <Setter Property="BorderBrush" Value="Black"/>

                                <Setter Property="BorderThickness" Value="0,0,2,0"/>
                                <Setter Property="VerticalContentAlignment" Value="Stretch"/>
                                <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                                
                                <Setter Property="Template" >
                                    <Setter.Value>
                                        <ControlTemplate TargetType="telerik:GridViewCell">
                                            <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">     
                                                <ContentPresenter Content="{Binding Traditional_Governance_Concerns}" />
                                            </Border>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </g:GridViewDataColumn.CellStyle>
                    </g:GridViewDataColumn>

6 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 20 Sep 2010, 07:32 AM
Hi Charles Nelson,

You may take a look at this forum thread for a reference. Let me know if it helps.
 

Kind regards,
Maya
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Charles Nelson
Top achievements
Rank 1
answered on 20 Sep 2010, 03:58 PM
Thanks for your response.  This helped a little.  I wanted though to affect the right border for only specfic columns not all.  do you have any other insight?

Charles
0
Maya
Telerik team
answered on 20 Sep 2010, 05:27 PM
Hi Charles Nelson,

The style defined in the sample project is set implicitly thus it is applied to the whole grid. However, once you set its Key property, it will be applied only to those columns that explicitly set it as their CellStyle. 
For example:

<Style TargetType="telerik:GridViewCell" x:Key="CellStyle">
    <Setter Property="Template" Value="{StaticResource GridViewCellTemplate}"/>
    <Setter Property="Padding" Value="5,0,3,0"/>
    ...
</Style>

<telerik:GridViewDataColumn DataMemberBinding="{Binding Property1}"
                           CellStyle="{StaticResource CellStyle}" />

Thus this style will be applied only to that particular column.

All the best,
Maya
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Charles Nelson
Top achievements
Rank 1
answered on 20 Sep 2010, 05:31 PM
I actually have been trying this for some time now and the style is not being applied for some reason.
0
Charles Nelson
Top achievements
Rank 1
answered on 20 Sep 2010, 05:51 PM

 

 

 

This is my XAML.

<
Style x:Key="CellStyle" TargetType="telerik:GridViewCell">

 

 

 

 

    <Setter Property="Template" Value="{StaticResource GridViewCellTemplate}"/>

 

 

 

 

    <Setter Property="Padding" Value="5,0,3,0"/>

 

 

 

 

    <Setter Property="BorderBrush" Value="{StaticResource GridView_GridLinesItemBorder}"/>

 

 

 

 

    <Setter Property="BorderThickness" Value="0,0,10,0"/>

 

 

 

 

    <Setter Property="VerticalContentAlignment" Value="Center"/>

 

 

 

 

    <Setter Property="HorizontalContentAlignment" Value="Stretch"/>

 

 

 

 

    <Setter Property="Background" Value="Transparent"/>

 

 

 

 

</Style>

 

<

 

 

g:GridViewDataColumn DataMemberBinding="{Binding Environment, Mode=TwoWay}" x:Name="Environment" Header="Environment" HeaderCellStyle="{StaticResource OveralWeightingCellStyle}" CellStyle="{StaticResource CellStyle}"/>

 

0
Charles Nelson
Top achievements
Rank 1
answered on 20 Sep 2010, 06:16 PM
Well i figured out what else I needed to do. After setting the BorderThickness on the PART_CellBorder it worked.
Tags
GridView
Asked by
Charles Nelson
Top achievements
Rank 1
Answers by
Maya
Telerik team
Charles Nelson
Top achievements
Rank 1
Share this question
or