Before this list turns entirely into an ausdotnet trollfest, how about a
Silverlight question?
Does anyone know why a textblock is not firing SizeChanged event when the
fontsize changes?
Example:
<Grid x:Name="LayoutRoot" Background="White">
<StackPanel>
<Button Content="Resize"
Name="button1"
Click="button1_Click" />
<TextBlock Name="result"
Text="Size goes here"/>
<TextBlock Name="actual"
Text="Actual goes here" />
</StackPanel>
<Canvas Height="200"
HorizontalAlignment="Left"
Margin="57,92,0,0"
Name="canvas1"
VerticalAlignment="Top"
Width="311">
<!--<Border Canvas.Top="10"
Canvas.Left="10"
BorderBrush="Green" BorderThickness="1">-->
<TextBlock Canvas.Top="10"
Canvas.Left="10"
Name="textblock1"
Width="180"
Text="Some Text" />
<!--</Border>-->
</Canvas>
</Grid>
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
textblock1.SizeChanged += textblock1_SizeChanged;
}
void textblock1_SizeChanged(object sender, SizeChangedEventArgs e)
{
result.Text = e.NewSize.ToString();
}
private void button1_Click(object sender, RoutedEventArgs e)
{
textblock1.FontSize += 1;
actual.Text = textblock1.ActualHeight.ToString();
}
}
Note that if I increase the fontsize, the ActualHeight changes, but the
SizeChanged event doesn't. Uncomment the border around the textblock and it
does start firing.
Regards,
Colin Savage
_______________________________________________
ozsilverlight mailing list
[email protected]
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight