Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4256628
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T05:22:50+00:00 2026-05-21T05:22:50+00:00

I have overriden the default row header style to use my custom button: <Style

  • 0

I have overriden the default row header style to use my custom button:

<Style x:Key="RowHeaderStyle" TargetType="DataGridRowHeader">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="DataGridRowHeader">
                <Button HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Style="{StaticResource RowHeaderButton}" />
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

The problem of course is that clicking the button no longer selects the row. Will I have to call a custom method on the IsPressed event? How would I know the row index? How would you go about doing it?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T05:22:50+00:00Added an answer on May 21, 2026 at 5:22 am

    I’ve ended up using only styling which turns out you can probably do what you want if it isn’t drastic. If anyone manages to get the code behind to handle row selection on DataGridHeaderBorder please let me know!
    Example:

    <...xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"...>
    
    <BooleanToVisibilityConverter x:Key="bool2VisibilityConverter"/>
    
    <LinearGradientBrush  x:Key="RowHeaderBackgroundBrush" EndPoint="0.728,0.5" StartPoint="0.272,0.5">
        <GradientStop Color="#FF494949" Offset="0"/>
        <GradientStop Color="#FF3E3E3E" Offset="1"/>
        <GradientStop Color="#FF494949" Offset="0.50"/>
        <GradientStop Color="#FF3E3E3E" Offset="0.50"/>
    </LinearGradientBrush>
    
    <LinearGradientBrush x:Key="RowHeaderBackgroundBrushMouseOver" EndPoint="0.728,0.5" StartPoint="0.272,0.5">
        <GradientStop Color="#FF666666" Offset="0"/>
        <GradientStop Color="#FF525252" Offset="1"/>
        <GradientStop Color="#FF666666" Offset="0.50"/>
        <GradientStop Color="#FF525252" Offset="0.50"/>
    </LinearGradientBrush>
    
    <Style x:Key="RowHeaderGripperStyle" TargetType="{x:Type Thumb}">
        <Setter Property="Height" Value="8"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="Cursor" Value="SizeNS"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Border Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style x:Key="RowHeaderBorder" TargetType="Border">
        <Setter Property="Background" Value="{StaticResource RowHeaderBackgroundBrush}" />
        <Setter Property="BorderBrush" Value="#FF313131" />
        <Setter Property="BorderThickness" Value="0,0,1,1" />
        <Setter Property="CornerRadius" Value="0" />
        <Setter Property="Margin" Value="0" />
    
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Background" Value="{StaticResource RowHeaderBackgroundBrushMouseOver}"></Setter>
            </Trigger>
        </Style.Triggers>
    </Style>
    
    <Style x:Key="RowHeaderStyle1" TargetType="DataGridRowHeader">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="DataGridRowHeader">
                    <Grid>
                        <Microsoft_Windows_Themes:DataGridHeaderBorder IsPressed="{TemplateBinding IsPressed}" Orientation="Horizontal" SeparatorBrush="{TemplateBinding SeparatorBrush}" SeparatorVisibility="{TemplateBinding SeparatorVisibility}" Style="{StaticResource RowHeaderBorder}">
                            <StackPanel Orientation="Horizontal">
                                <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center"/>
                                <Control SnapsToDevicePixels="false" Template="{Binding ValidationErrorTemplate, RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}}}" Visibility="{Binding (Validation.HasError), Converter={StaticResource bool2VisibilityConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}}}"/>
                            </StackPanel>
                        </Microsoft_Windows_Themes:DataGridHeaderBorder>
                        <Thumb x:Name="PART_TopHeaderGripper" Style="{StaticResource RowHeaderGripperStyle}" VerticalAlignment="Top"/>
                        <Thumb x:Name="PART_BottomHeaderGripper" Style="{StaticResource RowHeaderGripperStyle}" VerticalAlignment="Bottom"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to change default EventKitUI style? I'd like to have different background
I have a listview with a custom arrayadapter that handles about 15 strings. The
I have the following div in a page, but the button is being rendered
Lets say we have a class with a property called PetsName. If it is
My question is about memory use and objects in actionscript 2. If I have
I have a snippet to create a 'Like' button for our news site: <iframe
I have two product tables. Table A is the default table (comes from data
I have a JTable where I want to highlight some rows using a custom
I have a form within a SimpleModal modal, but when I try to use
I have overridden the windows ListBox in order to display an image and a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.