Ellipsis inside button content Windows Phone

160 views Asked by At

is it possible to get ellipsis inside button when content length increase the width of button. I tried editing template but did get much success?

1

There are 1 answers

0
Chris W. On BEST ANSWER

You should have some options. If it's just at the instance, you can just plop your content in as TextBlock so something like;

<Button>
  <Button.Content>
     <TextBlock Text="Blah Blah Blah" TextTrimming="WordEllipsis"/>
  </Button.Content>
</Button>

Or if you make a custom style template for Button you could replace the ContentPresenter in it with a TextBlock with it's content bound to the template like Text="{TemplateBinding Content}" and apply your TextTrimming directly to it. Except remember TextTrimming needs a boundary to invoke it, so your Button's may require like a set MaxWidth/Width or its parent panel will have to restrict its size to invoke the trimming.

Hope this helps, Cheers.

PS - This same concept can be used in WP, WPF, Silverlight, whatever really.