//Dynamically cretaed
TextBlock
TextBlock objTextBlock = new TextBlock();
objTextBlock.Loaded += new RoutedEventHandler(objTextBlock_Loaded);
//Access the dimensions using ActualHeight and ActualWidth in this event.
void objTextBlock_Loaded(object sender, RoutedEventArgs e)
{
TextBlock objTextBlock = sender as TextBlock;
MessageBox.Show(objTextBlock.ActualHeight.ToString());
MessageBox.Show(objTextBlock.ActualWidth.ToString());
}
TextBlock objTextBlock = new TextBlock();
objTextBlock.Loaded += new RoutedEventHandler(objTextBlock_Loaded);
//Access the dimensions using ActualHeight and ActualWidth in this event.
void objTextBlock_Loaded(object sender, RoutedEventArgs e)
{
TextBlock objTextBlock = sender as TextBlock;
MessageBox.Show(objTextBlock.ActualHeight.ToString());
MessageBox.Show(objTextBlock.ActualWidth.ToString());
}
No comments:
Post a Comment