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

  • Home
  • SEARCH
  • 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 993183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:22:51+00:00 2026-05-16T06:22:51+00:00

Hi i am looking for a way to align the buttons in my treeview

  • 0

Hi i am looking for a way to align the buttons in my treeview so that it will look like in the same column even if it is in any level.
Eg:

Item1 [Button]
 Item2 [Button]
Item3[Button]

i want it to look like

Item1  [Button]
 Item2 [Button]
Item3  [Button]

Any way that i can do this..?

  • 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-16T06:22:52+00:00Added an answer on May 16, 2026 at 6:22 am

    First, take a look at this blog entry Horizontal stretch on TreeViewItems. The default ControlTemplate for TreeViewItem does not allow the header content to stretch, which you will need it to do. Use the TreeViewItem Style that the author recommends, but change

    <Setter Property="HorizontalContentAlignment" Value="Center" />
    

    to

    <Setter Property="HorizontalContentAlignment" Value="Stretch" />
    

    Now you will have a TreeViewItem where the header content stretches across the entire width of the TreeViewItem. To get the TreeViewItem to render with text plus a button, use the ItemTemplate property of the TreeView. If you just want the buttons right-aligned, you could use a DockPanel:

    <TreeView.ItemTemplate>
        <HierarchicalDataTemplate ItemsSource="{Binding ...}">
            <DockPanel LastChildFill="False">
                <TextBlock DockPanel.Dock="Left" Text="{Binding ...}"/>
                <Button DockPanel.Dock="Right" Content="{Binding ...}"/>
            </DockPanel>
        </HierarchicalDataTemplate>
    </TreeView.ItemTemplate>
    

    If the contents of the buttons may have variable size and you want them all to have the same width, use a Grid with SharedSizeScope. Set Grid.IsSharedSizeScope="True" in the TreeView and then in your ItemTemplate do something like this:

    <TreeView.ItemTemplate>
        <HierarchicalDataTemplate ItemsSource="{Binding ...}">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition SharedSizeGroup="Buttons"/>
                </Grid.ColumnDefinitions>
                <TextBlock Text="{Binding ...}"/>
                <Button Grid.Column="1" Content="{Binding ...}"/>
            </Grid>
        </HierarchicalDataTemplate>
    </TreeView.ItemTemplate>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking for a way to get text-shadow that looks like css3 text-shadow, but
I'm looking for way to create list view as like in IOS with pinned
My problem is that I was looking for way to use both storyboard and
I'm looking for a very basic example that will change the TD font size
I'm looking for a way to convert text like this: <!DOCTYPE html PUBLIC \-//W3C//DTD
I'm looking for a way to align a table cell of style Subtitle to
I'm looking for a way to create toolbar buttons uisng jquery ui. I tried
I'm looking for a way to display a confirm dialog that's always centered on
In any language really, im looking for a simple (very simple) way to control
Basically, I am looking for a way to center a container that is 1600px

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.