WPF Image Button with text anchored at the bottom of the Button -
- i text anchored bottom of button, regardless of image aspect ratio.
- i image stretch fit remaining space in button.
this xaml have image fill remaining space, text placed right under image rather @ bottom of button. maybe need use other dockpanel, not sure use. text not need in label if there different way works.
thanks
<button height="150" width="150"> <dockpanel lastchildfill="true"> <label horizontalcontentalignment="center" dockpanel.dock="bottom">foo</label> <image source="bar.png" /> </dockpanel> </button>
the button element not automatically allow content fill entire button area. that, you'll have set both horizontalcontentalignment , verticalcontentalignment properties "stretch."
<button height="150" width="150" horizontalcontentalignment="stretch" verticalcontentalignment="stretch"> <dockpanel lastchildfill="true"> <label horizontalcontentalignment="center" dockpanel.dock="bottom">foo</label> <image source="bar.png" /> </dockpanel> </button>
Comments
Post a Comment