0
votes

I have a WPF button.The ContentControl inside this Button contains other UI elements like Textblock,Images etc.When i increase the font size of the Textblock or the Image etc,or i change the text inside Textblock,then some portion of the text and image can sometimes be seen overflowing outside the button's(ie parent control) height and width if the text ,fontsize or image size is more than the height and width of this button.I want to hide these overflowing portions of the text and image controls,ie which only the portions of the Textblock and Image which lie outside the button contentcontrol's height and width boundary.How can i do this?

1

1 Answers

0
votes

I was able to do it. I simply placed a the entire ContentControl inside a Label and it was done. ie earlier it was like this:-

<Button>
   <ContentControl>
       <TextBlock/>
   </ContentControl>
</Button>

Now i made it like this:-

<Button>
  <Label>
   <ContentControl>
       <TextBlock1/>
        <TextBock2/>
          .
          .
          .
       <Image1/>
       <Image2/>
   </ContentControl>
  </Label>
</Button>