First off, I apologize if this question has been asked before. I've done a bit of Google searching but I'm not really sure what the correct keywords are to find what I'm looking for.
Basically my problem is simple to understand. I have a Silverlight project and on the MainPage.xaml I have declared a UserControl and given it a height and a width.
<Grid>
<control:AlarmButton Height="50" Width="50" />
</Grid>
Now within AlarmButton I have a button that has its own Control Template which is set up the way I want. It has a content presenter within it right now.
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
x:Class="Alarms.AlarmButton">
<UserControl.Resources>
<ControlTemplate x:Key="StatusButton" >
<Viewbox Stretch="Fill">
<Grid>
<Path x:Name="Base" StrokeThickness="1.0" Stroke="#ff000000" StrokeMiterLimit="1.0" Fill="#ff666666" Data="F1 M 99.500,99.500 L 0.500,99.500 L 0.500,0.500 L 99.500,0.500 L 99.500,99.500 Z"/>
<Path x:Name="Interior" Opacity="0.5" StrokeThickness="1.0" Stroke="#ff191919" StrokeMiterLimit="1.0" Data="F1 M 97.500,97.500 L 2.500,97.500 L 2.500,2.500 L 97.500,2.500 L 97.500,97.500 Z">
<Path.Fill>
<LinearGradientBrush MappingMode="Absolute" StartPoint="2.500,2.499" EndPoint="97.500,97.499">
<LinearGradientBrush.GradientStops>
<GradientStop Offset="0.00" Color="#3FFFFFFF"/>
<GradientStop Offset="0.151" Color="Transparent"/>
<GradientStop Offset="1.00" Color="#BFFFFFFF"/>
<GradientStop Color="#53FFFFFF" Offset="0.655"/>
</LinearGradientBrush.GradientStops>
<LinearGradientBrush.Transform>
<MatrixTransform Matrix="1.000,0.000,-0.000,-1.000,0.000,100.000" />
</LinearGradientBrush.Transform>
</LinearGradientBrush>
</Path.Fill>
</Path>
<Path x:Name="LargeShader" Opacity="0.1" Fill="#ffffffff" Data="F1 M 94.667,18.667 L 94.667,94.667 L 6.333,94.667 C 6.333,94.667 94.667,67.348 94.667,18.667 Z"/>
<Path x:Name="SmallShader" Opacity="0.1" Fill="#ffffffff" Data="F1 M 94.667,43.667 L 94.667,94.667 L 20.333,94.667 C 20.333,94.667 94.667,76.334 94.667,43.667 Z"/>
<ContentPresenter x:Name="contentPresenter" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
Margin="{TemplateBinding Padding}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Grid>
</Viewbox>
</ControlTemplate>
</UserControl.Resources>
<Grid >
<Button Template="{StaticResource StatusButton}" >
<TextBlock Text="this is a text box"
TextTrimming="WordEllipsis" />
</Button>
</Grid>
</UserControl>
Later on I'm going to bind the Text property to a DependencyProperty so I can use this button with multiple text. What I want to happen is if the text is too big it will ellipse it and not have the box change or the textblock overflow. I just need to bind the height and width of the TextBlock to some values to contain it.
My question is this; is it possible for the TextBlock to bind its height and width to the values as declared in the MainPage.xaml? Or is this more complicated than I imagine? Is there a better way to go about this?
EDIT
This might give a little more info on what I'm trying to accomplish. This is my "button" with RobSiklos' changes

TextBlockto be a grand-child of theViewBox? Does it needs to grow when it's short? - XAMeLi