簡體   English   中英

我怎樣才能減少按鈕和它的彈出之間的差距? C# UWP

[英]How can i reduce the gap between button and it's flyout? C# UWP

我想在按鈕和彈出窗口之間有 0 邊距,我該怎么做?

這是我使用的代碼:

<Grid>
    <Button Height="100"
            Width="100"
            Content="More"
            Name="MoreButton">
        <Button.Flyout>
            
            <MenuFlyout x:Name="MoreButtonFlyout"
                        Placement="Bottom">
                <MenuFlyoutItem x:Name="ReplayOn"
                                FontSize="12"
                                FontFamily="Segoe UI Regular"
                                HorizontalAlignment="Left"
                                Foreground="#252525"
                                Text="Item 1"
                                Height="32"/>
            </MenuFlyout>
        </Button.Flyout>
    </Button>
    
</Grid>

在此處輸入圖像描述

我們可以通過為MenuFlyout設置負Margin來消除默認差距

<MenuFlyout x:Name="MoreButtonFlyout"
    Placement="Bottom">
    <MenuFlyout.MenuFlyoutPresenterStyle>
        <Style TargetType="MenuFlyoutPresenter">
            <Setter Property="Margin" Value="0,-4,0,0" />
        </Style>
    </MenuFlyout.MenuFlyoutPresenterStyle>
    ...
</MenuFlyout>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM