WPFレイアウトを動作させることができません。 ListBoxをウィンドウの下部に固定して垂直に伸ばしたいと思っています。現在のところ、StackPanel
(追加と削除ボタン)のコントロールの高さに合わせてサイズが変更され、追加されるアイテムに合わせてサイズが変更されます。 WinFormsでは、私はちょうどListView.Anchor
をTop|Left|Bottom|Right
に設定しますが、私は過去には生きていけません。私はDockPanel
に入れて、Canvas
などのすべてをラップするようなものを試しましたが、何も影響を受けていないようです。ここでWPFコントロールを垂直方向に伸ばす
私のXAMLです:
<Window x:Class="FileDropAdmin.ViewsTestListView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:shared="http://schemas.markpad.net/winfx/xaml/shared"
Title="ViewsTestListView" Height="300" Width="416">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock TextWrapping="Wrap" VerticalAlignment="Top" Text="Things:" />
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="4*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<ListBox x:Name="Things" DisplayMemberPath="ThingName" SelectedItem="CurrentThing" Grid.Column="0"/>
<StackPanel Margin="5 0 0 0" VerticalAlignment="Top" Grid.Column="1">
<Button x:Name="AddThing" Content="Add" Margin="0 0 0 0" VerticalAlignment="Top"/>
<Button x:Name="RemoveThing" Content="Remove" Margin="0 5 0 0" VerticalAlignment="Top"/>
</StackPanel>
</Grid>
</Grid>
</Window>
パーフェクト!ありがとう:-D –