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

[Solved] GridView RowStyle

1 Answer 141 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.
Iwan van Ee
Top achievements
Rank 1
Iwan van Ee asked on 01 Aug 2011, 01:24 PM
I keep struggling with the row styl of a gridview.
I have my own style set, but want a selected row and hover style too. The hover just needs to set the opacity to 1 and the selected needs to set the text style.

I dont have Blend here so I need to do it just in Xaml.

I used code from the example and changed it to this:

<ControlTemplate x:Key="MyCustomRowTemplate" TargetType="telerik:GridViewRow">
    <Border x:Name="rowsContainer" BorderThickness="1" BorderBrush="#FFC7C7C7"
            CornerRadius="2" Margin="2">
        <Grid Width="Auto" HorizontalAlignment="Stretch"
              Background="#FFD4D4D4" Opacity="0.9">
            <Grid.RowDefinitions>
                <RowDefinition Height="20"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="20" />
                <ColumnDefinition Width="20" />
                <ColumnDefinition Width="20" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <TextBlock Text="{Binding Number}" Margin="5,0,0,0" Grid.Row="0" Grid.Column="0"  VerticalAlignment="Center" HorizontalAlignment="Left"/>
            <TextBlock Text="{Binding Folder1}" Margin="5,0,0,0" Grid.Row="0" Grid.Column="1"  VerticalAlignment="Center" HorizontalAlignment="Left"/>
            <TextBlock Text="{Binding Revision}" Margin="5,0,0,0" Grid.Row="0" Grid.Column="2"  VerticalAlignment="Center" HorizontalAlignment="Left"/>
            <TextBlock Text="{Binding Size}" Margin="5,0,0,0" Grid.Row="0" Grid.Column="3"  HorizontalAlignment="Left" VerticalAlignment="Center"/>
            <TextBlock Text="{Binding Title}" Margin="5,0,0,0" Grid.Row="0" Grid.Column="4"  HorizontalAlignment="Left" VerticalAlignment="Center"/>
 
            <Border Grid.Column="3" Grid.Row="0" Grid.RowSpan="6"  Width="1"
                    VerticalAlignment="Stretch" HorizontalAlignment="Left" Margin="0,10" />
        </Grid>
    </Border>
</ControlTemplate>
<Style x:Key="rowStyle" TargetType="telerik:GridViewRow">
    <Setter Property="Template" Value="{StaticResource MyCustomRowTemplate}" />
</Style>


Where and how to set those styles.

1 Answer, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 01 Aug 2011, 01:27 PM
Hello Iwan,

 


You may take a look at the following forum thread "Highlight selected row in RadGridView with custom row layout".


Greetings,
Vanya Pavlova
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

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