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

Change the row border colour.

4 Answers 1289 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Mausami
Top achievements
Rank 1
Mausami asked on 20 Jun 2011, 02:09 PM

Hi Telerik team,

I am  trying to change the colour of the row border conditionally by following style settings. But I am unable to view the coloured border unless I change the value of the row border thickness to some value greater than 0. But increasing the row border thickness , increases the gray colored gap between rows.

Is there any other approach than can help change the colour of the gidview row border without changing the row border thickness i.e using the default border settings.

 

<telerik:RadGridView x:Name="radgvActivity" 
                             Grid.Row="2"
                             Margin="0" 
                             IsReadOnly="False"   RowIndicatorVisibility="Visible"                                                             
                             ScrollMode="RealTime" AutoGenerateColumns="False" 
                             EnableRowVirtualization="True"
                             CanUserFreezeColumns="False" CanUserResizeColumns="True" Width="780" Height="600"
                             BeginningEdit="radgvActivity_BeginningEdit"
                             RowEditEnded="radgvActivity_RowEditEnded">   
            <telerik:RadGridView.Resources>
                <Style TargetType="{x:Type telerik:GridViewRow}">
                    <Setter Property="BorderThickness" Value="1"></Setter>
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding Path=ActType}" Value="4">
                            <DataTrigger.Setters>
                                <Setter Property="BorderBrush" Value="Red" />
                            </DataTrigger.Setters>
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </telerik:RadGridView.Resources>

 

Many Thanks !!

Regards,
Mausami

4 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 20 Jun 2011, 02:36 PM
Hello Mausami,

 

Increasing the BorderThickness of a GridViewRow will change the outer border of a row. I suppose that you need to change the BorderThickness of a GridViewCell rather than to a GridViewRow. If you take a look at the default template of a GridViewCell you may see that its BorderThickness is bound to the RadGridView's GridLines. Thinking in this way you may change it only through editing the template of GridViewCell. Please find attached sample project that demonstrates how this can be achieved using StyleSelectors. The same approach is applicable to WPF as well. 



Best wishes,
Vanya Pavlova
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
Mausami
Top achievements
Rank 1
answered on 21 Jun 2011, 07:16 AM
Hi Vanya,

Could you please send me the implementation in WPF as I donot have Silverlight installed.
As soon as i open the solution, the CellBorderTest.csproj fails to load.

D:\MyFolder\279443_272833-CellBorderTest\CellBorderTest\CellBorderTest.csproj : error : Unable to read the project file 'CellBorderTest.csproj'.

D:\MyFolder\279443_272833-CellBorderTest\CellBorderTest\CellBorderTest.csproj(110,3): The imported project "C:\Program Files\MSBuild\Microsoft\Silverlight\v4.0\Microsoft.Silverlight.CSharp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.



Regards,
Mausami

 

0
Vanya Pavlova
Telerik team
answered on 21 Jun 2011, 07:50 AM
Hi Mausami,

 

You may solve this problem as it was demonstrated in the following blog post "How to solve "Silverlight.CSharp.targets was not found" problem".


Please give it a try and in case that there is something unclear let me know. 


Best wishes,
Vanya Pavlova
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
Mausami
Top achievements
Rank 1
answered on 29 Jun 2011, 11:30 AM

Hi Vanya,

Pardon my very little experience in WPF.

I see that the style that has been applied int the sample project has the border thickness increased to 4. Also, the red coloured border gets applied all around the border of the cell ofcourse since the target type mentioned is GridViewCell.

But my requirement is that I want to change the colour of the thin gray coloured border of the row.
Please let me know if this is possible.

<local:MyStyleSelector x:Key="styleSelector">
        <local:MyStyleSelector.LeagueStyle>
            <Style  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="4"/>
                <Setter Property="VerticalContentAlignment" Value="Center"/>
                <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                <Setter Property="Background" Value="Yellow"/>
            </Style>
        </local:MyStyleSelector.LeagueStyle>
    </local:MyStyleSelector>


Thanks.

Regards,
Mausami

Tags
GridView
Asked by
Mausami
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Mausami
Top achievements
Rank 1
Share this question
or