ScrollBarVisibility 열거형

정의

스크롤할 수 있는 콘텐츠의 ScrollBar 표시 여부를 지정합니다.

public enum class ScrollBarVisibility
public enum ScrollBarVisibility
type ScrollBarVisibility = 
Public Enum ScrollBarVisibility
상속
ScrollBarVisibility

필드

Auto 1

뷰포트에 일부 콘텐츠를 표시할 수 없으면 ScrollBar가 나타나고 ScrollViewer의 차원이 콘텐츠에 적용됩니다. 가로 ScrollBar의 경우 콘텐츠의 너비는 ViewportWidthScrollViewer로 설정됩니다. 세로 ScrollBar의 경우 콘텐츠의 높이는 ViewportHeightScrollViewer로 설정됩니다.

Disabled 0

뷰포트에 일부 콘텐츠를 표시할 수 없는 경우에도 ScrollBar가 표시되지 않습니다. 콘텐츠의 차원은 ScrollViewer 부모의 해당 차원으로 설정됩니다. 가로 ScrollBar의 경우 콘텐츠의 너비는 ViewportWidthScrollViewer로 설정됩니다. 세로 ScrollBar의 경우 콘텐츠의 높이는 ViewportHeightScrollViewer로 설정됩니다.

Hidden 2

뷰포트에 일부 콘텐츠를 표시할 수 없는 경우에도 ScrollBar가 표시되지 않습니다. ScrollViewer의 차원은 콘텐츠에 적용되지 않습니다.

Visible 3

ScrollBar가 항상 나타납니다. ScrollViewer의 차원이 콘텐츠에 적용됩니다. 가로 ScrollBar의 경우 콘텐츠의 너비는 ViewportWidthScrollViewer로 설정됩니다. 세로 ScrollBar의 경우 콘텐츠의 높이는 ViewportHeightScrollViewer로 설정됩니다.

예제

다음 예제에서는이 열거형의 멤버 값을 설정 하는 데는 HorizontalScrollBarVisibility 의 속성을 ScrollViewer 컨트롤.


// 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>

설명

이 열거형을 사용 하 여 설정 합니다 HorizontalScrollBarVisibilityVerticalScrollBarVisibility 속성 값을 ScrollViewer 컨트롤.

이 열거형의 멤버 값 지정 ScrollBar 지정 된 방향으로 표시 합니다. 이러한 멤버 값을 지정할 수도 있는지 여부를 해당 ScrollViewer 차원이 포함 된 콘텐츠에 적용 됩니다.

적용 하는 경우는 ViewportWidthViewportHeightScrollViewer 콘텐츠에 대 한 뷰포트 크기를 설정 하면 콘텐츠를 합니다.

적용 대상

추가 정보