xaml - align a button to the right in a listItem wpf -


i trying create listview item delete button on far right side of box. button right of text, prefer "stuck" right side of control. have tried following:

dockpanel:

dockpanel.dock="right"

horizontalalignment="right"

horizontalcontentalignment="right"

horizontalconteltalignment="stretch"

(not last 2 @ same time)

and adding area dock panel without specifying dock it

grid:

<grid.columndefinitions>     <columndefinition width="auto"/>     <columndefinition width="*"/> </grid.columndefinitions> 

and

<grid.columndefinitions>     <columndefinition width="*"/>     <columndefinition width="*"/> </grid.columndefinitions> 

and

<grid.columndefinitions>     <columndefinition width="auto"/>     <columndefinition width="*"/>     <columndefinition width="*"/> </grid.columndefinitions> 

etc. thing changes button's position in either case changing button's left margin. container resizable i'd button stay on right side of control. know why neither horizontal alignment, horizontal content alignment, columns, nor different width sizes seem affect position of button? can do?

p.s.: while know several other posts have been made people same problem, none of answers have accepted have helped situation @ far.

set listview's horizontalcontentalignment property stretch. stretches child element fill allocated space of listview:

<listview horizontalcontentalignment="stretch" ... > 

then use 1st grid method, swap columndefinition. column width button set auto size column content (the button). , 1 text set * take space possible. therefore, after allocating fixed space button in 2nd column, 1st column remaining space.

<grid.columndefinitions>     <columndefinition width="*"/> <!-- text -->     <columndefinition width="auto"/> <!-- delete button --> </grid.columndefinitions> 

Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

html - Why is a table with width of 75% wider than three tables which total 99%? -