Windows 10 用のアプリを開発しようとしています。しかし、まったく新しい画面サイズ設定では、要素を現在のデバイス画面のサイズに合わせる方法がわかりません。
たとえば、ウィンドウのサイズを変更する場合、TextBlock をウィンドウの幅に合わせたいとします。ViewBox、VariableSIzedWrapGrid などを試しましたが、問題が解決しないようです。誰でも知っていますか?
更新:下のウィンドウのサイズに合わせようとしているのは検索ボックスです。グリッドはウィンドウ全体を塗りつぶし、背景色を設定すると RelativePanel も塗りつぶされます。しかし、SearchBoxはストレッチを拒否します...検索ボックスのサイズを拡大したくありません.ウィンドウ/デバイスの幅に合わせて幅を広げたいだけです.
<!-- SEARCH GRID -->
<Grid Canvas.ZIndex="5" x:Name="GridSearchPackage" HorizontalAlignment="Stretch" Visibility="Visible" Opacity="0.85" Background="White">
<RelativePanel HorizontalAlignment="Stretch" Margin="5,5,0,0" >
<Button x:Name="ButtonBackSearchGrid" Height="36" Width="36" FontSize="10" Margin="0,7,5,0"
Style="{StaticResource BackButtonStyle}"
Click="ButtonBackSearchGrid_Click"
AutomationProperties.Name="Back"
AutomationProperties.AutomationId="BackButton"
AutomationProperties.ItemType="Navigation Button" BorderBrush="Black" BorderThickness="3">
<FontIcon x:Name="backButtonIcon" FontWeight="Bold" FontSize="20" Foreground="{StaticResource AppDarkBlueColor}" Glyph="" />
</Button>
<TextBlock x:Name="TextBlockPopupSearchTitle" RelativePanel.RightOf="ButtonBackSearchGrid" Foreground="{StaticResource AppDefaultBlueColor}" Text="Search XZY" FontSize="34"/>
<SearchBox FontSize="20" RelativePanel.Below="TextBlockPopupSearchTitle" HorizontalAlignment="Stretch" PlaceholderText="search" Margin="0,10,0,0" QuerySubmitted="SearchBox_QuerySubmitted" QueryText="{Binding SearchText, Mode=TwoWay}"/>
</RelativePanel>
</Grid>