WrapPanel.ItemWidth 속성

정의

WrapPanel 내에 포함된 모든 항목의 너비를 지정하는 값을 가져오거나 설정합니다.

public:
 property double ItemWidth { double get(); void set(double value); };
[System.ComponentModel.TypeConverter(typeof(System.Windows.LengthConverter))]
public double ItemWidth { get; set; }
[<System.ComponentModel.TypeConverter(typeof(System.Windows.LengthConverter))>]
member this.ItemWidth : double with get, set
Public Property ItemWidth As Double

속성 값

Double 내에 포함된 모든 항목의 균일한 너비를 나타내는 WrapPanel입니다. 기본값은 NaN입니다.

특성

예제

다음 예제에서는 설정 하는 ItemWidth 방법에 설명 합니다 XAML (Extensible Application Markup Language)에서 속성입니다.

<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" WindowTitle="WrapPanel Properties Sample">
  <Border HorizontalAlignment="Left" VerticalAlignment="Top" BorderBrush="Black" BorderThickness="2">
        <WrapPanel Orientation="Horizontal" Background="Azure" ItemWidth="25" ItemHeight="25" Height="200" Width="200">
            <Button Width="200">Button 1</Button>
            <Button>Button 2</Button>
            <Button>Button 3</Button>
        </WrapPanel>
  </Border>    
</Page>

다음 예제에서는 설정 하는 방법에 설명 합니다 ItemWidth 코드를 사용 하 여 속성입니다.


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


// Instantiate a new WrapPanel and set properties
myWrapPanel = gcnew WrapPanel();
myWrapPanel->Background = Brushes::Azure;
myWrapPanel->Orientation = Orientation::Horizontal;
myWrapPanel->ItemHeight = 25;

myWrapPanel->ItemWidth = 75;
myWrapPanel->Width = 150;
myWrapPanel->HorizontalAlignment = HorizontalAlignment::Left;
myWrapPanel->VerticalAlignment = VerticalAlignment::Top;

// Define 3 button elements. Each button is sized at width of 75, so the third button wraps to the next line.
btn1 = gcnew Button();
btn1->Content = "Button 1";
btn2 = gcnew Button();
btn2->Content = "Button 2";
btn3 = gcnew Button();
btn3->Content = "Button 3";

// Add the buttons to the parent WrapPanel using the Children.Add method.
myWrapPanel->Children->Add(btn1);
myWrapPanel->Children->Add(btn2);
myWrapPanel->Children->Add(btn3);

// Add the WrapPanel to the MainWindow as Content
mainWindow->Content = myWrapPanel;
mainWindow->Show();

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


// Instantiate a new WrapPanel and set properties
myWrapPanel = new WrapPanel();
myWrapPanel.Background = System.Windows.Media.Brushes.Azure;
myWrapPanel.Orientation = Orientation.Horizontal;
myWrapPanel.Width = 200;
myWrapPanel.HorizontalAlignment = HorizontalAlignment.Left;
myWrapPanel.VerticalAlignment = VerticalAlignment.Top;

// Define 3 button elements. The last three buttons are sized at width 
// of 75, so the forth button wraps to the next line.
btn1 = new Button();
btn1.Content = "Button 1";
btn1.Width = 200;
btn2 = new Button();
btn2.Content = "Button 2";
btn2.Width = 75;
btn3 = new Button();
btn3.Content = "Button 3";
btn3.Width = 75;
btn4 = new Button();
btn4.Content = "Button 4";
btn4.Width = 75;

// Add the buttons to the parent WrapPanel using the Children.Add method.
myWrapPanel.Children.Add(btn1);
myWrapPanel.Children.Add(btn2);
myWrapPanel.Children.Add(btn3);
myWrapPanel.Children.Add(btn4);

// Add the WrapPanel to the MainWindow as Content
mainWindow.Content = myWrapPanel;
mainWindow.Show();
WindowTitle = "WrapPanel Sample"

' Instantiate a new WrapPanel and set properties
Dim myWrapPanel As New WrapPanel()
myWrapPanel.Background = Brushes.Azure
myWrapPanel.Orientation = Orientation.Horizontal

myWrapPanel.Width = 200
myWrapPanel.HorizontalAlignment = Windows.HorizontalAlignment.Left
myWrapPanel.VerticalAlignment = Windows.VerticalAlignment.Top

' Define 3 button elements. The last three buttons are sized at width 
' of 75, so the forth button wraps to the next line.
Dim btn1 As New Button()
btn1.Content = "Button 1"
btn1.Width = 200
Dim btn2 As New Button()
btn2.Content = "Button 2"
btn2.Width = 75
Dim btn3 As New Button()
btn3.Content = "Button 3"
btn3.Width = 75
Dim btn4 As New Button()
btn4.Content = "Button 4"
btn4.Width = 75

' Add the buttons to the parent WrapPanel using the Children.Add method.
myWrapPanel.Children.Add(btn1)
myWrapPanel.Children.Add(btn2)
myWrapPanel.Children.Add(btn3)
myWrapPanel.Children.Add(btn4)

' Add the WrapPanel to the Page as Content
Me.Content = myWrapPanel
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" WindowTitle="WrapPanel Sample">
  <Border HorizontalAlignment="Left" VerticalAlignment="Top" BorderBrush="Black" BorderThickness="2">
        <WrapPanel Background="LightBlue" Width="200" Height="100">
            <Button Width="200">Button 1</Button>
            <Button>Button 2</Button>
            <Button>Button 3</Button>
            <Button>Button 4</Button>
        </WrapPanel>
  </Border>    
</Page>

설명

이 속성이 설정되지 않았거나 XAML(Extensible Application Markup Language) 또는 Double.NaN 코드에서 로 설정된 Auto 경우 레이아웃 파티션의 크기는 자식 요소의 와 같습니다DesiredSize.

자식 요소는 WrapPanel 너비 속성을 명시적으로 설정 해야 합니다. ItemWidth 예약 된 레이아웃 파티션의 크기를 지정 된 WrapPanel 자식 요소에 대 한 합니다. 결과적으로, ItemWidth 요소 자체의 너비를 보다 우선 합니다.

XAML 특성 사용

<object ItemWidth="double"/>  
- or -  
<object ItemWidth="qualifiedDouble"/>  
- or -  
<object ItemWidth="Auto"/>  

XAML 값

double
Double

문자열 표현을 Double 값 보다 크거나 0.0034 보다 작거나 같은 있지만 160000합니다. 값을 정규화 되지 않은 디바이스 독립적 픽셀 단위로 측정 됩니다. 문자열 소수점이 하를 명시적으로 포함 되지 해야 합니다.

qualifiedDouble
위에서 설명한 대로 double 값(제외Auto) 뒤에 다음 단위 지정자 px중 하나가 옵니다. , , in, cmpt.

px (기본값)은 디바이스 독립적 단위(단위당 1/96인치)입니다.

in 인치; 1에서 96px = =

cm 센티미터; 1cm==(96/2.54) px

pt 포인트; 1pt==(96/72) px

자동
원인 줄 높이가 현재 글꼴 특성에서 자동으로 결정 됩니다. 속성 값에 해당 NaN합니다.

종속성 속성 정보

식별자 필드 ItemWidthProperty
메타 데이터 속성 설정 true AffectsMeasure

적용 대상

추가 정보