MenuScrollingVisibilityConverter 클래스

정의

스크롤 메뉴에서 반복 단추의 표시 여부를 처리하는 데이터 바인딩 변환기를 나타냅니다.Represents a data-binding converter to handle the visibility of repeat buttons in scrolling menus.

public ref class MenuScrollingVisibilityConverter sealed : System::Windows::Data::IMultiValueConverter
public sealed class MenuScrollingVisibilityConverter : System.Windows.Data.IMultiValueConverter
type MenuScrollingVisibilityConverter = class
    interface IMultiValueConverter
Public NotInheritable Class MenuScrollingVisibilityConverter
Implements IMultiValueConverter
상속
MenuScrollingVisibilityConverter
구현

예제

다음 예제에서는 합니다 MenuScrollingVisibilityConverterControlTemplateScrollViewer 메뉴에 대 한 합니다.The following example uses the MenuScrollingVisibilityConverter in the ControlTemplate of a ScrollViewer for a menu. 전체 예제를 참조 하세요 보려면합니다.For the complete example, see Styling with ControlTemplates Sample.

<!--ScrollViewer for a MenuItem-->
<MenuScrollingVisibilityConverter x:Key="MenuScrollingVisibilityConverter" />

<Style x:Key="MenuScrollViewer"
       TargetType="{x:Type ScrollViewer}"
       BasedOn="{x:Null}">
  <Setter Property="HorizontalScrollBarVisibility"
          Value="Hidden" />
  <Setter Property="VerticalScrollBarVisibility"
          Value="Auto" />
  <Setter Property="Template">
    <Setter.Value>
      <ControlTemplate TargetType="{x:Type ScrollViewer}">
        <Grid SnapsToDevicePixels="True">
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
          </Grid.ColumnDefinitions>
          <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
          </Grid.RowDefinitions>
          <Border Grid.Row="1"
                  Grid.Column="0">
            <ScrollContentPresenter Margin="{TemplateBinding Padding}" />
          </Border>
          <RepeatButton Style="{StaticResource MenuScrollButton}"
                        Grid.Row="0"
                        Grid.Column="0"
                        Command="{x:Static ScrollBar.LineUpCommand}"
                        CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                        Focusable="False">
            <RepeatButton.Visibility>
              <MultiBinding FallbackValue="Visibility.Collapsed"
                            Converter="{StaticResource MenuScrollingVisibilityConverter}"
                            ConverterParameter="0">
                <Binding RelativeSource="{RelativeSource TemplatedParent}"
                         Path="ComputedVerticalScrollBarVisibility" />
                <Binding RelativeSource="{RelativeSource TemplatedParent}"
                         Path="VerticalOffset" />
                <Binding RelativeSource="{RelativeSource TemplatedParent}"
                         Path="ExtentHeight" />
                <Binding RelativeSource="{RelativeSource TemplatedParent}"
                         Path="ViewportHeight" />
              </MultiBinding>
            </RepeatButton.Visibility>
            <Path Fill="{DynamicResource {x:Static SystemColors.MenuTextBrushKey}}"
                  Data="{StaticResource UpArrow}" />
          </RepeatButton>
          <RepeatButton Style="{StaticResource MenuScrollButton}"
                        Grid.Row="2"
                        Grid.Column="0"
                        Command="{x:Static ScrollBar.LineDownCommand}"
                        CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                        Focusable="False">
            <RepeatButton.Visibility>
              <MultiBinding FallbackValue="Visibility.Collapsed"
                            Converter="{StaticResource MenuScrollingVisibilityConverter}"
                            ConverterParameter="100">
                <Binding RelativeSource="{RelativeSource TemplatedParent}"
                         Path="ComputedVerticalScrollBarVisibility" />
                <Binding RelativeSource="{RelativeSource TemplatedParent}"
                         Path="VerticalOffset" />
                <Binding RelativeSource="{RelativeSource TemplatedParent}"
                         Path="ExtentHeight" />
                <Binding RelativeSource="{RelativeSource TemplatedParent}"
                         Path="ViewportHeight" />
              </MultiBinding>
            </RepeatButton.Visibility>
            <Path Fill="{DynamicResource {x:Static SystemColors.MenuTextBrushKey}}"
                  Data="{StaticResource DownArrow}" />
          </RepeatButton>
        </Grid>
      </ControlTemplate>
    </Setter.Value>
  </Setter>
</Style>

설명

MenuScrollingVisibilityConverter 메뉴에 너무 많은 항목이 한 번에 화면에 맞게 때 메뉴 반복 단추를 표시할 것인지 여부를 결정 합니다.The MenuScrollingVisibilityConverter determines whether a menu should display the repeat buttons when a menu has too many items to fit on the screen at once. 변환기를 사용 하 여는 MultiBinding 바인딩이 포함 합니다.Use the converter with a MultiBinding that has four bindings. 부모 속성에는 바인딩이 있어야 ScrollViewer: 메뉴 항목은 세로로 구성 (즉, 메뉴에 대 한 기본값), 하는 경우 바인딩할 ComputedVerticalScrollBarVisibility, VerticalOffset합니다 ExtentHeight, 및 ViewportHeight합니다.The four bindings should be to properties of the parent ScrollViewer: If the menu items are organized vertically (which is the default for menus), bind to ComputedVerticalScrollBarVisibility, VerticalOffset, ExtentHeight, and ViewportHeight. 메뉴 항목은 가로로 경우 바인딩할 ComputedHorizontalScrollBarVisibility, HorizontalOffsetExtentWidth, 및 ViewportWidth합니다.If the menu items are organized horizontally, bind to ComputedHorizontalScrollBarVisibility, HorizontalOffset, ExtentWidth, and ViewportWidth.

설정 MultiBinding.ConverterParameter 0 또는 100입니다.Set MultiBinding.ConverterParameter to 0 or 100. 값을 백분율로 처리 되 고 단추를 숨길지 여부를 결정 때는 ScrollViewer 지정된 된 위치에 있습니다.The value is treated as a percentage and determines whether a button is hidden when the ScrollViewer is at the given location. 경우는 ScrollViewer 위쪽의 위치는 ScrollViewer 은 0% 및 위쪽 단추는 숨겨집니다.When the ScrollViewer is at the top, the position of the ScrollViewer is 0% and the top button is hidden. 경우는 ScrollViewer 아래쪽에서의 위치는는 ScrollViewer 100% 및 아래쪽 단추는 숨겨집니다.When the ScrollViewer is at the bottom, the position of the ScrollViewer is 100% and the bottom button is hidden.

생성자

MenuScrollingVisibilityConverter()

MenuScrollingVisibilityConverter 클래스의 새 인스턴스를 초기화합니다.Initializes a new instance of the MenuScrollingVisibilityConverter class.

메서드

Convert(Object[], Type, Object, CultureInfo)

값을 소스에서 대상으로 이동하면 호출됩니다.Called when moving a value from a source to a target.

ConvertBack(Object, Type[], Object, CultureInfo)

지원되지 않습니다.Not supported.

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.Determines whether the specified object is equal to the current object.

(다음에서 상속됨 Object)
GetHashCode()

기본 해시 함수로 작동합니다.Serves as the default hash function.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type을 가져옵니다.Gets the Type of the current instance.

(다음에서 상속됨 Object)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.Creates a shallow copy of the current Object.

(다음에서 상속됨 Object)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.Returns a string that represents the current object.

(다음에서 상속됨 Object)

적용 대상