i have 2 buttons on grid. on right button there should text shown left aligned , text right aligned. in tries far 2 strings positioned in center of button , not left , right.
once solved need space between text , left/right borders of button. can help?
my xaml-code far start:
<usercontrol x:class="mynamespace.myclass" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:ignorable="d" d:designheight="300" d:designwidth="900"> <grid> <grid.columndefinitions> <columndefinition width="3*"/> <columndefinition width="1*"/> </grid.columndefinitions> <button> <textblock text="left button"></textblock> </button> <button grid.column="1"> <grid> <grid.columndefinitions> <columndefinition width="auto"/> <columndefinition width="*"/> <columndefinition width="auto"/> </grid.columndefinitions> <textblock text="left"></textblock> <textblock text="right" grid.column="1"></textblock> </grid> </button> </grid> </usercontrol>
don´t blame me not putting stuff in resourcedictionary. wanted make example simple.
you need add horizontalcontentalignment="stretch"
button
in order contents take full space. after that, make space between text , button borders, add 2 more grid columns @ first , last position.
xaml:
<usercontrol x:class="mynamespace.myclass" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:ignorable="d" d:designheight="300" d:designwidth="900"> <grid> <grid.columndefinitions> <columndefinition width="3*"/> <columndefinition width="1*"/> </grid.columndefinitions> <button> <textblock text="left button"></textblock> </button> <button grid.column="1" horizontalcontentalignment="stretch"> <grid> <grid.columndefinitions> <columndefinition width="10"/> <columndefinition width="auto"/> <columndefinition width="*"/> <columndefinition width="auto"/> <columndefinition width="10"/> </grid.columndefinitions> <textblock text="left" grid.column="1"></textblock> <textblock text="right" grid.column="3"></textblock> </grid> </button> </grid>
Comments
Post a Comment