0
UWPアプリのXAMLコントロールがスタックパネルに配置されていない
グリッドにスタックパネルがあり、向きが水平です。ボタン、テキストブロック、さらに2つのボタンを順番に表示したい。
スタックパネルは、それ自身のグリッドの行を占有します。
スタックパネルでは、2つのボタンが右側の境界に揃っていません。彼らは75%のポジションでぶらぶらしている。 HorizontalOrientation属性を使用すると、これらの2つのボタンタグに違いはありません。
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" Orientation="Horizontal">
<Button x:Name="btnShow" Margin="0,0,5,0">Show</Button>
<TextBlock HorizontalAlignment="Stretch">Nothing searched for yet</TextBlock>
<Button x:Name="btnLeft" HorizontalAlignment="Right" Margin="5,0,5,0"><</Button>
<Button x:Name="btnRight" HorizontalAlignment="Right">></Button>
</StackPanel></Grid></Grid>
Buttonに 'HorizontalAlignment =" Right ""を設定する代わりに、 'StackPanel'自体に設定してください。 – AVK
これは、グループ全体を右側に移動させて、左に大きな隙間を残しました。 – VinceP1974
「幅」の列をGridに追加し、TextBoxをその列に移動します。最後の列には、右に移動したいボタンだけが含まれている必要があります。 – AVK