Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. TreeItem with right-aligned delete button

TreeItem with right-aligned delete button

Scheduled Pinned Locked Moved WPF
csharpwpfdata-structuresquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Steve The Plant
    wrote on last edited by
    #1

    Hi, I'm new to WPF, so please bear with me. I have a tree of objects. For every item on the tree, I'd like to have a delete button that is right-aligned. Here's my best text-based representation: [----------------------------] scene entity 1 x entity 2 x child entity 1 x child entity 2 x entity 3 x [----------------------------] The 'x' represents a delete button, or a small x icon. What's the best way to do this? Thanks!

    A 1 Reply Last reply
    0
    • S Steve The Plant

      Hi, I'm new to WPF, so please bear with me. I have a tree of objects. For every item on the tree, I'd like to have a delete button that is right-aligned. Here's my best text-based representation: [----------------------------] scene entity 1 x entity 2 x child entity 1 x child entity 2 x entity 3 x [----------------------------] The 'x' represents a delete button, or a small x icon. What's the best way to do this? Thanks!

      A Offline
      A Offline
      ABitSmart
      wrote on last edited by
      #2

      You can override the TreeViewItem template ?

      <Style TargetType="TreeViewItem">
      <Setter Property="Template">
      <Setter.Value>

              <ControlTemplate TargetType="TreeViewItem">
                  <StackPanel Orientation="Horizontal">
                      <TextBox></Button>
                      <Button>X</Button>               
                 </StackPanel>
              </ControlTemplate>
          </Setter.Value>
      </Setter>
      

      </Style>

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups