ScrollBarVisibility ScrollBarVisibility ScrollBarVisibility ScrollBarVisibility Enum

定義

スクロール可能なコンテンツについて、ScrollBar の参照可能範囲を指定します。Specifies the visibility of a ScrollBar for scrollable content.

public enum class ScrollBarVisibility
public enum ScrollBarVisibility
type ScrollBarVisibility = 
Public Enum ScrollBarVisibility
継承
ScrollBarVisibilityScrollBarVisibilityScrollBarVisibilityScrollBarVisibility

フィールド

Auto Auto Auto Auto 1

ビューポートがコンテンツ全体を表示できない場合に ScrollBar が表示され、ScrollViewer のサイズがコンテンツに適用されます。A ScrollBar appears and the dimension of the ScrollViewer is applied to the content when the viewport cannot display all of the content. 水平 ScrollBar の場合、コンテンツの幅は ViewportWidthScrollViewer に設定されます。For a horizontal ScrollBar, the width of the content is set to the ViewportWidth of the ScrollViewer. 垂直 ScrollBar の場合、コンテンツの高さは ViewportHeightScrollViewer に設定されます。For a vertical ScrollBar, the height of the content is set to the ViewportHeight of the ScrollViewer.

Disabled Disabled Disabled Disabled 0

ビューポートがコンテンツ全体を表示できない場合でも、ScrollBar は表示されません。A ScrollBar does not appear even when the viewport cannot display all of the content. コンテンツのサイズは、親の ScrollViewer のサイズに設定されます。The dimension of the content is set to the corresponding dimension of the ScrollViewer parent. 水平 ScrollBar の場合、コンテンツの幅は ViewportWidthScrollViewer に設定されます。For a horizontal ScrollBar, the width of the content is set to the ViewportWidth of the ScrollViewer. 垂直 ScrollBar の場合、コンテンツの高さは ViewportHeightScrollViewer に設定されます。For a vertical ScrollBar, the height of the content is set to the ViewportHeight of the ScrollViewer.

Hidden Hidden Hidden Hidden 2

ビューポートがコンテンツ全体を表示できない場合でも、ScrollBar は表示されません。A ScrollBar does not appear even when the viewport cannot display all of the content. ScrollViewer のサイズは、コンテンツに適用されません。The dimension of the ScrollViewer is not applied to the content.

Visible Visible Visible Visible 3

ScrollBar は常に表示されます。A ScrollBar always appears. ScrollViewer のサイズはコンテンツに適用されます。The dimension of the ScrollViewer is applied to the content. 水平 ScrollBar の場合、コンテンツの幅は ViewportWidthScrollViewer に設定されます。For a horizontal ScrollBar, the width of the content is set to the ViewportWidth of the ScrollViewer. 垂直 ScrollBar の場合、コンテンツの高さは ViewportHeightScrollViewer に設定されます。For a vertical ScrollBar, the height of the content is set to the ViewportHeight of the ScrollViewer.

次の例は、この列挙体のメンバー値を使用して、 HorizontalScrollBarVisibility ScrollViewerコントロールのプロパティを設定する方法を示しています。The following example shows how to use the member values of this enumeration to set the HorizontalScrollBarVisibility property of the ScrollViewer control.


// Create the application's main window
mainWindow = gcnew System::Windows::Window();
mainWindow->Title = "ScrollViewer Sample";

// Define a ScrollViewer
myScrollViewer = gcnew ScrollViewer();
myScrollViewer->HorizontalScrollBarVisibility = ScrollBarVisibility::Auto;

// Add Layout control
myStackPanel = gcnew StackPanel();
myStackPanel->HorizontalAlignment = HorizontalAlignment::Left;
myStackPanel->VerticalAlignment = VerticalAlignment::Top;

TextBlock^ myTextBlock = gcnew TextBlock();
myTextBlock->TextWrapping = TextWrapping::Wrap;
myTextBlock->Margin = System::Windows::Thickness(0, 0, 0, 20);
myTextBlock->Text = "Scrolling is enabled when it is necessary. Resize the Window, making it larger and smaller.";

Rectangle^ myRectangle = gcnew Rectangle();
myRectangle->Fill = Brushes::Red;
myRectangle->Width = 500;
myRectangle->Height = 500;

// Add child elements to the parent StackPanel
myStackPanel->Children->Add(myTextBlock);
myStackPanel->Children->Add(myRectangle);

// Add the StackPanel as the lone Child of the Border
myScrollViewer->Content = myStackPanel;

// Add the Border as the Content of the Parent Window Object
mainWindow->Content = myScrollViewer;
mainWindow->Show();


// Create the application's main window
mainWindow = new Window ();
mainWindow.Title = "ScrollViewer Sample";

// Define a ScrollViewer
myScrollViewer = new ScrollViewer();
myScrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;

// Add Layout control
myStackPanel = new StackPanel();
myStackPanel.HorizontalAlignment = HorizontalAlignment.Left;
myStackPanel.VerticalAlignment = VerticalAlignment.Top;

TextBlock myTextBlock = new TextBlock();
myTextBlock.TextWrapping = TextWrapping.Wrap;
myTextBlock.Margin = new Thickness(0, 0, 0, 20);
myTextBlock.Text = "Scrolling is enabled when it is necessary. Resize the Window, making it larger and smaller.";

Rectangle myRectangle = new Rectangle();
myRectangle.Fill = Brushes.Red;
myRectangle.Width = 500;
myRectangle.Height = 500;

// Add child elements to the parent StackPanel
myStackPanel.Children.Add(myTextBlock);
myStackPanel.Children.Add(myRectangle);
            
// Add the StackPanel as the lone Child of the Border
myScrollViewer.Content = myStackPanel;

// Add the Border as the Content of the Parent Window Object
mainWindow.Content = myScrollViewer;
mainWindow.Show ();


'Define a ScrollViewer.
Dim myScrollViewer As New ScrollViewer
myScrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto

'Add Layout control.
Dim myStackPanel As New StackPanel
myStackPanel.HorizontalAlignment = System.Windows.HorizontalAlignment.Left
myStackPanel.VerticalAlignment = System.Windows.VerticalAlignment.Top

Dim myTextBlock As New TextBlock
myTextBlock.TextWrapping = TextWrapping.Wrap
myTextBlock.Margin = New Thickness(0, 0, 0, 20)
myTextBlock.Text = "Scrolling is enabled when it is necessary. Resize the Window, making it larger and smaller."

Dim myRectangle As New Rectangle
myRectangle.Fill = Brushes.Red
myRectangle.Width = 500
myRectangle.Height = 500

'Add child elements to the parent StackPanel.
myStackPanel.Children.Add(myTextBlock)
myStackPanel.Children.Add(myRectangle)

'Add the StackPanel as the lone Child of the Border
myScrollViewer.Content = myStackPanel
Me.Content = myScrollViewer
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      WindowTitle="ScrollViewer Sample">
  <ScrollViewer HorizontalScrollBarVisibility="Auto">
    <StackPanel VerticalAlignment="Top" HorizontalAlignment="Left">
      <TextBlock TextWrapping="Wrap" Margin="0,0,0,20">Scrolling is enabled when it is necessary. 
      Resize the window, making it larger and smaller.</TextBlock>
      <Rectangle Fill="Red" Width="500" Height="500"></Rectangle>
    </StackPanel>
  </ScrollViewer>
</Page>

注釈

この列挙体を使用しHorizontalScrollBarVisibilityVerticalScrollBarVisibilityScrollViewerコントロールのプロパティとプロパティの値を設定します。Use this enumeration to set the HorizontalScrollBarVisibility and VerticalScrollBarVisibility property values of the ScrollViewer control.

この列挙体のメンバー値はScrollBar 、指定された方向の可視性を指定します。The member values of this enumeration specify ScrollBar visibility in a given direction. また、これらのメンバー値は、 ScrollViewer対応するディメンションが、囲まれたコンテンツに適用されるかどうかも指定します。These member values also specify whether the corresponding ScrollViewer dimension is applied to its enclosed content.

コンテンツにViewportWidthまたはViewportHeightScrollViewer適用する場合は、コンテンツのビューポートのサイズを設定します。When you apply the ViewportWidth or ViewportHeight to ScrollViewer content, you set the viewport size for the content.

適用対象

こちらもご覧ください