I have the following simple code (see below) I copied from a book. But I have a couple of questions about the line <Grid TextBlock.FontSize="48">
.
From what I gather, TextBlock.FontSize is an attached property but I initially thought that attached properties were meant to reference parent objects (i.e. when the Grid.Row attached property references the parent Grid element). But from how it is used here it may be that my understanding is incorrect? Is this an attached property and if so can it be used for child elements?
Second, TextBlock.FontSize is set on the grid. But, no where in the xaml do I use a TextBlock element (that I know of). I only used Buttons with Content defined. Yet if I change the TextBlock.FontSize to a different value the font size changes. Therefore, how is TextBlock.FontSize being used? Where is the TextBlock?
Thank you in advance.
<Window x:Class="UseAGrid.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid TextBlock.FontSize="48">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="250" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Button Grid.RowSpan="2"
Content="2 Rows" />
<GridSplitter Grid.Row="0"
Grid.RowSpan="2"
Grid.Column="1"
Width="1"
Background="Green"
ResizeBehavior="PreviousAndNext"
ResizeDirection="Columns" />
<Button Grid.Column="2"
Grid.ColumnSpan="2"
Content="2 Columns" />
<Button Grid.Row="1"
Grid.Column="2"
Content="1,2" />
<Button Grid.Row="1"
Grid.Column="3"
Content="1,3" />
</Grid>
</Window>