c# - How do I place a text over a image in a button in WinRT -
i want create button using image background , on top of background want place text.
i tried this:
<button style="{staticresource imagebuttonstyle}"> <stackpanel> <textblock text="test"></textblock> <image source="ms-appx:///skins/images/buton.png" stretch="none" /> </stackpanel> </button>
the text not centered correctly.
<button style="{staticresource imagebuttonstyle}"> <stackpanel> <textblock text="test"></textblock> <label padding="0">my button text</label> </stackpanel> </button>
the control label
doesn't exists.
how center correctly text on image in first attempt? know better way?
you should use grid instade stackpanel. try this:
<button > <grid> <image source="..." stretch="none" /> <textblock text="test" verticalalignment="center" horizontalalignment="center"/> </grid> </button>
Comments
Post a Comment