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

Pressed VisualState for GridViewHeaderCell

6 Answers 80 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Sergey
Top achievements
Rank 1
Sergey asked on 14 Sep 2011, 04:03 PM
Hello!
I try to customize style for GridViewHeaderCell. I created template for it and it works fine. But I'm surprized that it have no "Pressed" visual state. I want to change background of header of GridView when it pressed. Any ideas how I can do it?

6 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 16 Sep 2011, 07:38 AM
Hi Sergey,

Actually, the pressed state of GridViewHeaderCell is the selected one. So, you may try to edit the "_Selected" elements of its template. Please take a look at our online documentation for a reference.

 

Greetings,
Maya
the Telerik team

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

0
Sergey
Top achievements
Rank 1
answered on 16 Sep 2011, 07:39 AM
Selected state doesn't works.
Can you share sample where it works for you?
0
Maya
Telerik team
answered on 16 Sep 2011, 08:04 AM
Hello Sergey,

I am sending you a sample project illustrating how you may change the background of a GridViewHeaderCell when it is selected. You mainly need to edit the following part:

<Border x:Name="GridViewHeaderCell_Selected" BorderBrush="{StaticResource GridView_HeaderOuterBorder_Selected}" BorderThickness="{TemplateBinding BorderThickness}" Grid.ColumnSpan="2" Opacity="0">
                    <Border BorderBrush="{StaticResource GridView_HeaderInnerBorder_Selected}" BorderThickness="1" Background="{StaticResource GridView_HeaderBackground_Selected}"/>
                </Border>
 

Kind regards,
Maya
the Telerik team

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

0
Sergey
Top achievements
Rank 1
answered on 20 Sep 2011, 12:17 PM
ok, thanks
0
Karan
Top achievements
Rank 1
answered on 10 Jun 2013, 07:34 PM
I have the same question Maya. Is there a way to change a header background color only when the mouse is in the down position (pressed position)? I am looking for something similar to what is described in this article: http://msdn.microsoft.com/en-us/library/ms742286(v=vs.85).aspx, but for a silverlight project.

Thanks,

Karan
0
Maya
Telerik team
answered on 13 Jun 2013, 08:06 AM
Hi Karan,

Such behavior in Silverlight will require more code and customization that in WPF. You need to create your own custom state (for pressed position of the header), handle MouseLeftButtonDown event, call GoToState method of VisualStateManager to invoke the state you want. However, you will need to handle MouseLeftButtonUp event and return the state of the header to is default one when it is clicked - sorted in descending, ascending or none state.

Regards,
Maya
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Sergey
Top achievements
Rank 1
Answers by
Maya
Telerik team
Sergey
Top achievements
Rank 1
Karan
Top achievements
Rank 1
Share this question
or