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

How To Reposition Sort Arrow in GridViewHeaderCell

3 Answers 174 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Don
Top achievements
Rank 1
Don asked on 30 Aug 2012, 12:52 AM
I'm already modifying the look of the GridViewHeaderCell using a Style resource in my WPF desktop application. I would now like to move the sorting arrow from its default position at the top of the header cell to the right of the header cell.  Can this be done by setting a property or two?  I'd prefer to stay away from Expression Blend.  Thanks.

        <Style TargetType="{x:Type telerik:GridViewHeaderCell}">
            <Setter Property="Foreground" Value="White" />
            <Setter Property="Background">
                <Setter.Value>
                    <LinearGradientBrush EndPoint="0.5,0.971" StartPoint="0.5,0.042">
                        <GradientStop Color="#26FFFFFF" Offset="0" />
                        <GradientStop Color="#00FFFFFF" Offset="1" />
                        <GradientStop Color="#26FFFFFF" Offset="0.467" />
                        <GradientStop Color="#00FFFFFF" Offset="0.475" />
                    </LinearGradientBrush>
                </Setter.Value>
            </Setter>
            <Setter Property="Width" Value="Auto" />
            <!-- Any setter properties I can put here to move the sorting arrow?  -->
        </Style>


3 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 30 Aug 2012, 05:33 AM
Hi,

 I'm afraid we don't have such property. Actually this is the general idea behind the whole XAML, Expression Blend, WPF, Silverlight and now Window 8. You do not need to create properties for every single small setting since you have full control on how the component will look and behave. 

Regards,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Don
Top achievements
Rank 1
answered on 30 Aug 2012, 06:07 PM
I already understand the whole idea behind WPF and XAML, thank you. However, I am new to doing a lot of control customizing. :)

None of the Visual Studio design views work in the code base I have inherited, so I can't just "right click on a control and open it in expression blend."  Besides, our department didn't buy expression blend.  It's into the XAML for me.

What to I have to modify to move this arrow? Do I have to make an entirely new ControlTemplate for the GridViewHeaderCell?   Can I copy Telerik's, modify the grid layout and then use the modified template to override the original one?

I don't need you to do the work for me. I just need to be pointed in the right direction.  Thanks.
0
Vanya Pavlova
Telerik team
answered on 03 Sep 2012, 07:17 AM
Hello Don,

 


Actually you should predefine the whole template of GridViewHeaderCell. There you will find an element named PART_SortIndicator you may play with its properties to reposition it in the way you need. 
For example - if you want to right align this element just set its HorizontalAlignment to Right.
Some Margin might be of help as well. Once you predefine the template of this element you may mark it either as an implicit one or set it to a column using the HeaderCellStyle attribute. 





Greetings,
Vanya Pavlova
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

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