glasswizzard
Well-known member
- Joined
- Nov 22, 2019
- Messages
- 126
- Programming Experience
- Beginner
Below is the XAML for the form that I recreated using just a grid, I added two gridsplitters to it (at the bottom) but they don't seem to actually do anything, I can't resize the grid with them. Is it because I've set specific sizes for the grid and it won't change from them?
C#:
<Window x:Class="FontViewer.MainWindow"
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"
xmlns:local="clr-namespace:FontViewer"
mc:Ignorable="d"
Title="Font Viewer" Height="480" Width="600">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="2*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="0.8*"/>
<RowDefinition Height="0.5*"/>
<RowDefinition Height="0.7*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="0.3*"/>
</Grid.RowDefinitions>
<Border CornerRadius="6"
BorderThickness="1"
BorderBrush="Gray"
Background="LightGray"
Padding="8"
Margin="6"
Grid.ColumnSpan="2">
<TextBlock FontSize="14"
TextWrapping="Wrap">
Select a font to view from the list below.
You can change the text by typing in the region at the bottom.
</TextBlock>
</Border>
<ListBox x:Name="FontList"
Grid.Row="1"
Grid.RowSpan="5"
HorizontalAlignment="Right"
ItemsSource="{x:Static Fonts.SystemFontFamilies}"
Width="190"
Margin="0 0 0 8">
</ListBox>
<TextBox x:Name="SampleText"
Grid.Row="5"
Grid.Column="1"
VerticalAlignment="Center"
Height="18"
MinLines="4"
Margin="0 0 6 0"
TextWrapping="Wrap"
ToolTip="Type here to change the preview text.">
The quick brown fox jumps over the lazy dog.
</TextBox>
<TextBlock Text="{Binding ElementName=SampleText, Path=Text}"
FontFamily="{Binding ElementName=FontList,Path=SelectedItem}"
FontSize="10"
TextWrapping="Wrap"
Margin="6"
Grid.Column="1"
Grid.Row="1"/>
<TextBlock Text="{Binding ElementName=SampleText, Path=Text}"
FontFamily="{Binding ElementName=FontList,Path=SelectedItem}"
FontSize="16"
TextWrapping="Wrap"
Margin="6"
Grid.Column="1"
Grid.Row="2"/>
<TextBlock Text="{Binding ElementName=SampleText, Path=Text}"
FontFamily="{Binding ElementName=FontList,Path=SelectedItem}"
FontSize="24"
TextWrapping="Wrap"
Margin="6"
Grid.Column="1"
Grid.Row="3"/>
<TextBlock Text="{Binding ElementName=SampleText, Path=Text}"
FontFamily="{Binding ElementName=FontList,Path=SelectedItem}"
FontSize="32"
TextWrapping="Wrap"
Grid.Column="1"
Grid.Row="3"
Margin="6,84,6,5.765" Grid.RowSpan="2"/>
<GridSplitter Grid.Row="1"
Grid.Column="0"
Grid.RowSpan="6"
Width="3"
Background="Black"
ResizeBehavior="PreviousAndNext"
ResizeDirection="Columns" />
<GridSplitter Grid.Row="5"
Grid.Column="1"
Height="3"
Background="Black"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
ResizeBehavior="PreviousAndNext"
ResizeDirection="Rows" />
</Grid>
</Window>
Last edited: