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

Simple Theme: Vertical grid lines missing.

2 Answers 134 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Christopher
Top achievements
Rank 1
Christopher asked on 16 Oct 2008, 07:55 PM
Greetings,
  I have run into an issue when changing the GridViewRow background color.  I have changed the background color based on IsAlternating in the example below: (Note that VerticalGridLinesVisibility is set to True)
<Window.Resources> 
        <Style TargetType="{x:Type telerik:GridViewRow}" > 
            <Style.Triggers> 
                <DataTrigger Binding="{Binding IsAlternating}" Value="False"
                    <DataTrigger.Setters> 
                        <Setter Property="Background" Value="#ABD5F3" /> 
                    </DataTrigger.Setters> 
                </DataTrigger> 
                <DataTrigger Binding="{Binding IsAlternating}" Value="True"
                    <DataTrigger.Setters> 
                        <Setter Property="Background" Value="#CAEEFE" /> 
                    </DataTrigger.Setters> 
                </DataTrigger> 
            </Style.Triggers> 
        </Style> 
    </Window.Resources> 
    <Grid> 
        <telerik:RadGridView Name="radGridViewStyleSimpleTheme" VerticalGridlinesVisibility="Visible"
            <telerik:Theming.Theme> 
                <simple:SimpleTheme /> 
            </telerik:Theming.Theme> 
        </telerik:RadGridView> 
    </Grid> 

In this example the grid will not show vertical lines with in the rows.  I'm guessing this is due to how the controls are layered and the control (Border?) that serves as the row background is overlaying the base grid structure and hiding the grid lines.

I was going to attempt to just change the cell colors themselves based on whether or not they were in an alternating row, however I haven't found a way to accomplish that. I have been unable to find a way to tell if the cell is in an alternating row.

Is there tweak I can make to the control templates to allow grid lines to show in this scenario?

Thanks,
  Chris

2 Answers, 1 is accepted

Sort by
0
Accepted
Dimitar Dobrev
Telerik team
answered on 17 Oct 2008, 03:51 PM
Hello Chris,

I was able to make the grid lines visible without painting cells separately. You simply need to change the custom template of GridViewItemsControl, which I sent you earlier. The XML elements:

<telerik:GridViewBackground  VerticalAlignment="Top" x:Name="PART_GridViewBackground" Margin="0,0,0,0" Grid.Row="2" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Stretch"  IsHitTestVisible="False"/> 
<ScrollViewer Name="PART_ItemsScrollViewer" Focusable="False" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" CanContentScroll="True" Grid.Row="2" Grid.RowSpan="2" Grid.ColumnSpan="2"
    <ItemsPresenter Margin="0, 0, 0, 0"/> 
</ScrollViewer> 

need to be switched:

<ScrollViewer Name="PART_ItemsScrollViewer" Focusable="False" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" CanContentScroll="True" Grid.Row="2" Grid.RowSpan="2" Grid.ColumnSpan="2"
    <ItemsPresenter Margin="0, 0, 0, 0"/> 
</ScrollViewer> 
<telerik:GridViewBackground  VerticalAlignment="Top" x:Name="PART_GridViewBackground" Margin="0,0,0,0" Grid.Row="2" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Stretch"  IsHitTestVisible="False"/> 


I also attached the same project as before, with this change applied (just in case). Please, feel free to notify us if you encounter any other issues.

All the best,
Dimitar Dobrev,
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Christopher
Top achievements
Rank 1
answered on 17 Oct 2008, 05:49 PM
Thanks a ton Dimitar!

I knew it should be just a simple control template change, I was not seeing it though.

Chris
Tags
GridView
Asked by
Christopher
Top achievements
Rank 1
Answers by
Dimitar Dobrev
Telerik team
Christopher
Top achievements
Rank 1
Share this question
or