UIElement.Clip Właściwość
Definicja
Pobiera lub ustawia geometrię używaną do definiowania konturu zawartości elementu.Gets or sets the geometry used to define the outline of the contents of an element. Jest to właściwość zależności.This is a dependency property.
public:
property System::Windows::Media::Geometry ^ Clip { System::Windows::Media::Geometry ^ get(); void set(System::Windows::Media::Geometry ^ value); };
public System.Windows.Media.Geometry Clip { get; set; }
member this.Clip : System.Windows.Media.Geometry with get, set
Public Property Clip As Geometry
Wartość właściwości
Geometria, która ma być używana w przypadku przycinania rozmiarów obszaru.The geometry to be used for clipping area sizing. Wartość domyślna to null Geometry .The default is a null Geometry.
Przykłady
Ten przykład pokazuje, jak zdefiniować region elementu struktury Clip .This example shows how to define a framework element's Clip region. Aby zdefiniować klip, użyj Geometry (na przykład, EllipseGeometry Aby ustawić Clip właściwość elementu.To define a clip, use a Geometry (for example, an EllipseGeometry to set the element's Clip property. Widoczny będzie tylko obszar należący do regionu geometrii.Only the area that is within the region of the geometry will be visible.
Poniższy przykład pokazuje Image element bez zdefiniowanego regionu klipu.The following example shows an Image element without a defined clip region. Ponieważ żaden region nie jest zdefiniowany, zostanie wyświetlony cały obraz.Because no clip region is defined, the entire image is displayed.
<Image Source="sampleImages\Waterlilies.jpg"
Width="200" Height="150" HorizontalAlignment="Left" />
Obraz bez regionu wycinkaImage with No Clip Region
W następnym przykładzie jest tworzony identyczny obraz, z tą różnicą, że ma zdefiniowany region przycinania.In the next example, an identical Image is created, except that it has a defined clip region. Zostanie wyświetlona tylko część obrazu znajdująca się w obszarze EllipseGeometry .Only the part of the image that is within the area the EllipseGeometry will be displayed.
<Image
Source="sampleImages\Waterlilies.jpg"
Width="200" Height="150" HorizontalAlignment="Left">
<Image.Clip>
<EllipseGeometry
RadiusX="100"
RadiusY="75"
Center="100,75"/>
</Image.Clip>
</Image>
Obraz z regionem klipu eliptycznegoImage with an Elliptical Clip Region
Poniższy przykład pokazuje, jak animować region elementu struktury Clip .The following example shows how animate a framework element's Clip region. W tym przykładzie EllipseGeometry jest używany do definiowania regionu klipu eliptycznego dla Image elementu.In this example, an EllipseGeometry is used to define an elliptical clip region for an Image element. A PointAnimation Animuj Właściwość geometrii elips Center od (0, 0) do (200, 150).A PointAnimation animates the ellipse geometry's Center property from (0, 0) to (200, 150). Animacja rozpoczyna odtwarzanie po załadowaniu obrazu i powtarza się w nieskończoność.The animation starts playing after the image is loaded and repeats indefinitely.
<Image
Source="sampleImages\Waterlilies.jpg"
Width="200" Height="150" HorizontalAlignment="Left">
<Image.Clip>
<EllipseGeometry x:Name="MyEllipseGeometry1"
RadiusX="100"
RadiusY="75"
Center="100,75"/>
</Image.Clip>
<Image.Triggers>
<EventTrigger RoutedEvent="Image.Loaded">
<BeginStoryboard>
<Storyboard>
<PointAnimation
Storyboard.TargetName="MyEllipseGeometry1"
Storyboard.TargetProperty="(EllipseGeometry.Center)"
From="0,0" To="200,150" Duration="0:0:3" RepeatBehavior="Forever"
AutoReverse="True" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Image.Triggers>
</Image>
Pełny przykład można znaleźć w przykładowym regionie klipu.For the full sample, see the Clip Region Sample.
Uwagi
Elementy spoza geometrii zostaną przesłonięte wizualnie w renderowanym układzie.Elements outside the geometry will be visually clipped in the rendered layout. Geometria nie musi być prostokątna.The geometry does not have to be rectangular.
Informacje dotyczące właściwości zależnościDependency Property Information
Pole identyfikatoraIdentifier field | ClipProperty |
Właściwości metadanych ustawione na true Metadata properties set to true |
BrakNone |