次のコードでは、With = "*"の2つの列定義にあるのと同じ幅の2つのリストボックスで終了すると予想しました。このテキストはListBoxよりもはるかに小さく、したがってTextBlockにはテキストを格納するのに十分なスペースがあるため、意味を成さないListBox。*が付いたWPFグリッドの2つの列が同じサイズでない理由を教えてください。
<Window x:Class="UnderstandSizing.Window5"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window5"
SizeToContent="WidthAndHeight"
ResizeMode="NoResize" >
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Text="Text1longer" Grid.Row="0" Grid.Column="0" x:Name="Test1" />
<TextBlock Text="Text1" Grid.Row="0" Grid.Column="2" />
<ListBox Grid.Row="1" Grid.Column="0" Height="150" />
<ListBox Grid.Row="1" Grid.Column="2" Height="150" />
<TextBlock Grid.Row="2" Grid.ColumnSpan="3" Text="This textblock sets the max width" Width="300" />
</Grid>
</Window>
WPF自動サイズ変更機能は...私は怒っ任意のアイデアを運転していますか?おかげさまで
EDIT:VS2008ではすべてのことが重要です。
まったくありません。 IDEからSOへ、直接変更は行われません。 VS2008で作業する。多分このことは重要です。 –
@SoMoS weird。私はまったく同じコードを使用していました。ウィンドウやプロジェクトの中には何もありません。 .NETバージョン?私は4.0とVS2010を使用していた – Ray
確かです。私はNET 3.5とVS2008を使用しています –