質問

ボトムアップバー内のAppBartoggleButtonが押されたときに(情報コンテンツを含む)単純なフライアウトを表示しようとしていますが、私の解決策は機能しません。:(

これは私のコードです:

<Page.BottomAppBar>
        <CommandBar>
            <AppBarToggleButton x:Uid="MapPageAppBarLegend" Label="" Icon="List">
                <FlyoutBase.AttachedFlyout>
                    <Flyout>
                        <TextBlock Text="Informations here..."/>
                    </Flyout>
                </FlyoutBase.AttachedFlyout>
            </AppBarToggleButton>
        </CommandBar>
</Page.BottomAppBar>
.

何も現れない..誰かがこの飛行声を見せてくれることができますか? 私の英語をお詫び申し上げます。:)

PAME

役に立ちましたか?

解決

すべてが非常に明確に説明されています(MSDN (もあります)そこにある非常に良い例):

何も表示されないものは何も表示されませんので、ボタン(http://msdn.microsoft.com/en-us/library/windows/apps/xaml/windows/jp .UI.XAML.CONTROLS.APPBARTOGGLEBUTTON "> AppBartoggleButton はButtonクラスから派生しません):

ユーザーがボタンをクリックすると、ボタンに接続されているフライアウトが自動的に開きます。フライアウトを開くためにイベントを処理する必要はありません。 (これには、AppBarButton

のように、ボタンから派生するコントロールが含まれます。

もちろん、FlyoutFrameworkElementを追加できますが、手動で開く必要があります。

FlyoutBase.AttachedFlyout添付プロパティを使用して、フライアウトコントロールをFrameworkElementオブジェクトに添付できます。そうすると、タップされたイベントなどのFrameworkElementの対話に応答し、コード内のフライアウトを開く必要があります。

XAML - リソースにFlyoutを定義し、それをボタンに添付する:

<Page.Resources>
    <Flyout x:Key="myFlyout" Placement="Top">
        <TextBlock Text="Informations here..."/>
    </Flyout>
</Page.Resources>
<Page.BottomAppBar>
    <CommandBar>
        <AppBarToggleButton x:Uid="MapPageAppBarLegend" Label="First" Icon="List"
                            FlyoutBase.AttachedFlyout="{StaticResource myFlyout}"
                            Click="AppBarToggleButton_Click"/>                
    </CommandBar>
</Page.BottomAppBar>
.

および後ろのコード内のイベント:

private void AppBarToggleButton_Click(object sender, RoutedEventArgs e)
{
    FlyoutBase.ShowAttachedFlyout((FrameworkElement)sender);  
}
.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top