2017-03-15 24 views
2

私はUWPアプリケーションでフライアウトを実装しています。 FlyHoutのAutoSuggestBoxをPageHeaderに表示し、その下に表示します。 ScreenshotXAML UWPフライアウト位置

これは私のXAMLです:

<Button x:Name="searchButton" Margin="0" Padding="0" BorderThickness="0" RelativePanel.AlignBottomWith="pageHeader"> 
     <Button.Content> 
      <FontIcon Height="48" Width="48" Glyph="&#xE094;"/> 
     </Button.Content> 
     <Button.Flyout> 
      <Flyout> 
       <Flyout.FlyoutPresenterStyle> 
        <Style TargetType="FlyoutPresenter"> 
         <Setter Property="Padding" Value="0"/> 
         <Setter Property="BorderThickness" Value="0"/> 
         <Setter Property="HorizontalAlignment" Value="Right"/> 
         <Setter Property="Height" Value="40"/> 
         <Setter Property="VerticalAlignment" Value="Top"/> 
        </Style> 
       </Flyout.FlyoutPresenterStyle> 
       <StackPanel Margin="0" VerticalAlignment="Top"> 
        <AutoSuggestBox x:Name="innerSearchBox" PlaceholderText="Search" VerticalAlignment="Top"/> 
       </StackPanel> 
      </Flyout> 
     </Button.Flyout> 
    </Button> 

どのように私はAutoSugesstBoxはで表示され、PageHeaderを埋めることができますか?

+0

することによってこれを行うことができますか? – erotavlas

+0

はい@erotavlas、まさに! – Yvder

+0

私はあなたが代わりにポップアップを試してみるべきだと思います。これは、ツールチップのようなフライアウトや別の小さなウィンドウのように、レイアウトの一部として必要な任意の図形でボタンの隣に置くことができます。 – Neme

答えて

0

フライアウト用に左に配置を設定します。

<Flyout Placement="Left"> 

アプリケーションの幅全体をカバーするためにAutoSuggestBoxを作りたい場合は、アプリケーションビューの幅にAutoSuggestBoxの幅を設定します。

あなたがストアアプリでの検索の動作方法のように意味するか

public MainPage() 
{ 
    this.InitializeComponent(); 
    ApplicationView.GetForCurrentView().VisibleBoundsChanged += MainPage_VisibleBoundsChanged; 
    var bound = ApplicationView.GetForCurrentView().VisibleBounds; 
    innerSearchBox.Width = (int)bound.Width - 48;  //48 is the size of the button 
} 

private void MainPage_VisibleBoundsChanged(ApplicationView sender, object args) 
{ 
    var bound = ApplicationView.GetForCurrentView().VisibleBounds; 
    innerSearchBox.Width = (int)bound.Width - 48; 
} 
関連する問題