Problem: when adding ScrollViwer around the grid, the scaling of the grid is canceled!
Eksampel: I created a grid width of 3 columns, 1. coulymn should always be 2 times larger than columns 2 and 3! Without ScrollViewer, this is always true, but when added, it allows each column to decide its own size.
<Window x:Class="alternatingGridRow.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="200" Width="Auto" Loaded="WindowLoaded"> <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled"> <Grid x:Name="LayoutRoot" ShowGridLines="True"> <Grid.RowDefinitions> <RowDefinition Height="Auto" MinHeight="23" MaxHeight="60"/> <RowDefinition/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="2*"/> <ColumnDefinition Width="1*"/> <ColumnDefinition Width="1*"/> </Grid.ColumnDefinitions> <TextBlock HorizontalAlignment="Stretch" Text="sdasdasdasdsadsadasddasdck" TextWrapping="Wrap" VerticalAlignment="Top" /> <TextBlock Foreground="Red" Grid.Column="1" HorizontalAlignment="Stretch" Text="sdasdasdasdsadsadasddasdck" TextWrapping="Wrap" VerticalAlignment="Top" /> </Grid> </ScrollViewer>
As you can clearly see, the scaling factors are completely wrong! Since column 2. is suitable for large! and 3. the column is a random size ...
Invalid scaling factors
Any advice on this is well received .... Cheers Martin
Martin Søberg
source share