Path.Data Właściwość
Definicja
Ważne
Niektóre informacje odnoszą się do produktu w wersji wstępnej, który może zostać znacząco zmodyfikowany przed wydaniem. Firma Microsoft nie udziela żadnych gwarancji, jawnych lub domniemanych, w odniesieniu do informacji podanych w tym miejscu.
Pobiera lub ustawia Geometry element, który określa kształt do narysowania.
public:
property System::Windows::Media::Geometry ^ Data { System::Windows::Media::Geometry ^ get(); void set(System::Windows::Media::Geometry ^ value); };
public System.Windows.Media.Geometry Data { get; set; }
member this.Data : System.Windows.Media.Geometry with get, set
Public Property Data As Geometry
Wartość właściwości
Opis kształtu, który ma zostać narysowany.
Przykłady
W poniższym przykładzie pokazano, jak utworzyć Path element i ustawić Data właściwość przy użyciu kodu.
//Add the Path Element
myPath = gcnew Path();
myPath->Stroke = Brushes::Black;
myPath->Fill = Brushes::MediumSlateBlue;
myPath->StrokeThickness = 4;
myPath->HorizontalAlignment = HorizontalAlignment::Left;
myPath->VerticalAlignment = VerticalAlignment::Center;
EllipseGeometry^ myEllipseGeometry = gcnew EllipseGeometry();
myEllipseGeometry->Center = Point(50, 50);
myEllipseGeometry->RadiusX = 25;
myEllipseGeometry->RadiusY = 25;
myPath->Data = myEllipseGeometry;
myGrid->Children->Add(myPath);
//Add the Path Element
myPath = new Path();
myPath.Stroke = System.Windows.Media.Brushes.Black;
myPath.Fill = System.Windows.Media.Brushes.MediumSlateBlue;
myPath.StrokeThickness = 4;
myPath.HorizontalAlignment = HorizontalAlignment.Left;
myPath.VerticalAlignment = VerticalAlignment.Center;
EllipseGeometry myEllipseGeometry = new EllipseGeometry();
myEllipseGeometry.Center = new System.Windows.Point(50,50);
myEllipseGeometry.RadiusX = 25;
myEllipseGeometry.RadiusY = 25;
myPath.Data = myEllipseGeometry;
myGrid.Children.Add(myPath);
' Add a Path Element
Dim myPath As New Path()
myPath.Stroke = Brushes.Black
myPath.Fill = Brushes.MediumSlateBlue
myPath.StrokeThickness = 4
myPath.HorizontalAlignment = HorizontalAlignment.Left
myPath.VerticalAlignment = VerticalAlignment.Center
Dim myEllipseGeometry As New EllipseGeometry()
myEllipseGeometry.Center = New System.Windows.Point(50, 50)
myEllipseGeometry.RadiusX = 25
myEllipseGeometry.RadiusY = 25
myPath.Data = myEllipseGeometry
myGrid.Children.Add(myPath)
Uwagi
Aby narysować proste kształty, użyj EllipseGeometryobiektów , LineGeometryi RectangleGeometry . Aby narysować krzywe, łuki lub złożone kształty, użyj PathGeometry obiektu . Aby utworzyć geometrię złożoną, użyj elementu GeometryGroup. Aby połączyć geometrie, użyj elementu CombinedGeometry.
Użycie elementu właściwości XAML
<Path>
<Path.Data>
singleGeometry
</Path.Data>
</Path>
Użycie atrybutu XAML
<object Data="moveAndDrawCommands"/>
Wartości XAML
singleGeometry Pojedynczy element obiektu, który pochodzi z klasy Geometry. Może to być jeden z następujących elementów:
Jedną z prostych geometrii EllipseGeometry, LineGeometrylub RectangleGeometry.
Pojedynczy GeometryGroupelement , który obsługuje inne geometrie jako elementy podrzędne. Zobacz sekcję Wartości XAML dla elementu GeometryGroup.
Element PathGeometry, który obsługuje elementy obiektów podrzędnych, które ustanawiają model obiektu geometrii ścieżki rysunków i segmentów. Zobacz sekcję Wartości XAML dla elementu PathGeometry.
moveAndDrawCommands Co najmniej jedno polecenie przenoszenia i rysuj. Aby uzyskać pełną składnię, zobacz Path Markup Syntax (Składnia znaczników ścieżki).
Informacje o właściwości zależności
| Produkt | Wartość |
|---|---|
| Pole identyfikatora | DataProperty |
Właściwości metadanych ustawione na true |
AffectsRender, AffectsMeasure |