Marvin's Blog【程式人生】

Ability will never catch up with the demand for it

29 Oct 2020

Uwp Controls槽点合集

UWP CommandBar

OverflowButtonVisibility

根据CommandBar.OverflowButtonVisibility Property,OverflowButtonVisibility默认是Auto。对应的CommandBarOverflowButtonVisibility Enum的解释是:

The overflow button automatically hides when there are no secondary commands and the closed state of the CommandBar is the same as the open state.

但是,如果在CommandBar使用了AppBarSeparator,...按键就会一直显示在那里,不会自动隐藏。

OverflowPopup

如果改了AppBarButton的Width,那么如果DynamicOverflow的情况下,这个AppBarButton被收进Overflow Popup,那么会在overflow Popup中占据空间,但是不显示内容。

AppBarButtonRevealStyle

CommandBar中Style中指定了AppBarButton和AppBarToggleButton的隐式Style,如果修为自定义的style,那么会引起Overflow Popup显示的异常。

  <Style x:Key="CommandBarRevealStyle" TargetType="CommandBar">
...
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="CommandBar">
          <Grid x:Name="LayoutRoot">
            <Grid.Resources>
              <Style TargetType="AppBarButton" BasedOn="{StaticResource AppBarButtonRevealStyle}" />
              <Style TargetType="AppBarToggleButton" BasedOn="{StaticResource AppBarToggleButtonRevealStyle}" />
              ...
comments powered by Disqus