WPF Image Button with text anchored at the bottom of the Button -


  1. i text anchored bottom of button, regardless of image aspect ratio.
  2. 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

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -