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

[Solved] Changing the color of group item

3 Answers 229 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.
Farhan
Top achievements
Rank 1
Farhan asked on 03 Sep 2010, 08:19 PM
I have problem to change the color of group panel item e.g. radgridview column which i draged and droped in group panel, how i can do that, similarly i am not able to change color of row header indicator as well.

Thanks
  

3 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 07 Sep 2010, 01:17 PM
Hi Farhan,

In order to change the GridViewHeaderCell when dropping it in GridViewGroupPanel, you can create a simple style targeted at GridViewGroupPanelCell and set its background property to the color you want.
Similarly, to change the RowIndicator of the GridViewRow, you can use Blend for creating a custom style for the GridViewRow. All you need to do is to find Part_IndicatorPresenter and predefine its properties so that they meet your requirements.
Attached is a sample solution that demonstrates this approach.
If you need any additional information, do not hesitate to contact us.


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
Farhan
Top achievements
Rank 1
answered on 07 Sep 2010, 03:41 PM

Its totally confusing for me i need to change the backgroundcolor of GridViewHeaderRow

#FF08486B
for
GridViewHeaderRow 
and i wrote this code
<Grid x:Name="LayoutRoot" Background="#FFFFFFCC">

        <Grid.Resources>
            
           
            <Style x:Key="GridView_HeaderBackground" TargetType="telerik:GridViewHeaderRow">
                <Setter Property="Background" Value="#FF08486B" />
            </Style>
            
        </Grid.Resources>
</Grid>

and in radGridview i am adding this
HeaderRowStyle="{StaticResource GridView_HeaderBackground}" 

but backgroundcolor is not getting change


Thanks

0
Vanya Pavlova
Telerik team
answered on 08 Sep 2010, 07:53 AM
Hi Farhan,

I tried your code on my machine and it works as expected. I suppose that you have set the ColumnWidth property of the RadGridView to * and then you would not be able to see the GridViewHeaderRow style.
I just want to mention you that if you want to change also the GridViewHeaderCells, you should create a simple style for the GridViewHeaderCell, because the GridViewHeaderRow's style would not affect GridViewHeaderCells.
Please try this code and let me know how it goes:
<Grid x:Name="LayoutRoot" Background="#FFFFFFCC" DataContext="{Binding Source={StaticResource SampleDataSource}}">
         <Grid.Resources>                                    
            <Style x:Key="GridView_HeaderBackground" TargetType="telerik:GridViewHeaderRow">                
                <Setter Property="Background" Value="#FF08486B" />            
             </Style>  
             <Style x:Key="headerCellStyle" TargetType="telerik:GridViewHeaderCell">   
                <Setter Property="Background" Value="#FF08486B" />  
                </Style>              
         </Grid.Resources>
        <telerik:RadGridView Margin="32,24,43,143" AutoGenerateColumns="False" HeaderRowStyle="{StaticResource GridView_HeaderBackground}" ItemsSource="{Binding Collection}">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn Header="Property1" HeaderCellStyle="{StaticResource headerCellStyle}" DataMemberBinding="{Binding Property1}"/>
                <telerik:GridViewDataColumn Header="Property1" DataMemberBinding="{Binding Property2}"/>
              
                </telerik:RadGridView.Columns>
            </telerik:RadGridView>
    </Grid>

Kind regards,
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
Tags
GridView
Asked by
Farhan
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Farhan
Top achievements
Rank 1
Share this question
or