2016-06-13 30 views
1

我在Windows上工作的通用应用程序(视窗10)Mobile.I在菜单Flyout.The菜单弹出按钮的默认宽度查询其余同此代码后不下降:在windows通用应用程序移动版中减小Menu Flyout的大小?

<AppBarButton Icon="OpenWith" Label="More.." Width="55"> 
        <AppBarButton.Flyout> 
         <MenuFlyout> 
          <MenuFlyout.MenuFlyoutPresenterStyle> 
           <Style TargetType="MenuFlyoutPresenter"> 
            <Setter Property="Margin" Value="0,-31,0,0" /> 
            <Setter Property="Background" Value="#FFE45427" /> 
            <Setter Property="FontSize" Value="12" /> 
            <Setter Property="BorderBrush" Value="Transparent" /> 
            <Setter Property="MinWidth" Value="70" /> 
           </Style> 
          </MenuFlyout.MenuFlyoutPresenterStyle> 
          <MenuFlyoutItem Text="Logout" FontSize="13" Padding="8,8,0,8" Click="MenuFlyoutItem_Click" /> 
          <MenuFlyoutItem Text="Sales" FontSize="13" Padding="8,8,0,8" Click="appbarsales_Click" /> 
         </MenuFlyout> 
        </AppBarButton.Flyout> 
       </AppBarButton> 

图片:

See the Image of Menu Flyout

+0

您是否试过[this](http://stackoverflow.com/questions/32948697/tooglemenuflyout-and-menuflyoutpresenterstyle-set-width-windows-10-mobile)? –

+0

@AlexejSommer:是的。我也试过这个东西,但我想减少我的菜单飞出宽度only.I可以轻松地增加宽度,但我不知道如何减少宽度,所以善意建议一个更好的方式,如果你知道。 –

回答

0
<Page.BottomAppBar> 
     <AppBar x:Name="applicationbar"> 
     <AppBarButton Icon="OpenWith" Label="More.." x:Name="more_item"> 
        <AppBarButton.Flyout> 
         <MenuFlyout> 
          <MenuFlyout.MenuFlyoutPresenterStyle> 
           <Style TargetType="MenuFlyoutPresenter"> 
            <Setter Property="Margin" Value="0,-31,0,0" /> 
            <Setter Property="Background" Value="#FFE45427" /> 
            <Setter Property="FontSize" Value="12" /> 
            <Setter Property="BorderBrush" Value="Transparent" /> 
            <Setter Property="MaxWidth" Value="70"/> 

           </Style> 
          </MenuFlyout.MenuFlyoutPresenterStyle> 
          <MenuFlyoutItem Text="Logout" FontSize="13" Padding="8,8,0,8" Click="MenuFlyoutItem_Click" > 

          </MenuFlyoutItem> 
          <MenuFlyoutItem Text="Sales" FontSize="13" Padding="8,8,0,8" Click="appbarsales_Click" /> 
         </MenuFlyout> 
        </AppBarButton.Flyout> 
       </AppBarButton> 
      </StackPanel> 

     </AppBar> 

使用MaxWidth属性,从而缩短菜单的默认大小弹出

相关问题