UIElement.ClipToBounds UIElement.ClipToBounds UIElement.ClipToBounds UIElement.ClipToBounds Property

定義

取得或設定是否裁剪此元素 (或來自此元素的子元素) 的內容,以符合容器元素大小的值。Gets or sets a value indicating whether to clip the content of this element (or content coming from the child elements of this element) to fit into the size of the containing element. 這是相依性屬性。This is a dependency property.

public:
 property bool ClipToBounds { bool get(); void set(bool value); };
public bool ClipToBounds { get; set; }
member this.ClipToBounds : bool with get, set
Public Property ClipToBounds As Boolean

屬性值

如果應該裁剪內容即為 true;否則為 falsetrue if the content should be clipped; otherwise, false. 預設值為 falseThe default value is false.

備註

子項目的ClipToBounds有不同的效果,在版面配置行為,取決於是否的高度和寬度的父項目也就決定所Height / Width或是MaxHeight / MaxWidth.For child elements, ClipToBounds has different effects on layout behaviors depending on whether the height and width of the parent element are being determined by Height / Width or MaxHeight / MaxWidth. MaxHeight / MaxWidth 父元素的值為何會一律遵守ClipToBounds和有效的裁剪一律會裁剪內容,根據這些最大值。MaxHeight / MaxWidth of the parent element are always respected regardless of the value of ClipToBounds and the effective clipping will always clip the content based on these maximums. 家長Height / Width設定將不會裁剪內容時ClipToBoundsfalse,但會將裁剪內容 ifClipToBoundstrueThe parent's Height / Width settings will not clip the content when ClipToBounds is false, but will clip the content if ClipToBounds is true.

請注意,預設為false是一般的行為,因為在實作UIElement類別。Note that defaulting to false is the general behavior as implemented in the UIElement class. 您可針對任何指定的項目衍生自UIElement覆寫這個屬性預設為該執行個體中的相依性屬性中繼資料true改。It is possible for any given element that derives from UIElement to override the dependency property metadata for this property in that instance to default to true instead. 數個現有的衍生的類別覆寫此中繼資料及/或調整相依性屬性預設值。Several existing derived classes override this metadata and/or adjust the dependency property default value.

InkCanvasInkPresenter,並Popup每個覆寫這個預設值為trueInkCanvas, InkPresenter, and Popup each override the default value to be true.

FrameworkElement 覆寫這個相依性屬性的中繼資料。FrameworkElement overrides the metadata for this dependency property. 具體而言,FrameworkElement指定此屬性,以允許屬性值繼承 (Inheritstrue中繼資料中)。Specifically, FrameworkElement designates this property to allow property value inheritance (Inherits is true in metadata). 在此內容中的屬性值繼承表示,如果有任何其他值的子項目ClipToBounds指派透過本機值或最接近的父項目的值,與指派 (同樣地,無論是在樣式中,依預設此值的樣式值,或在本機值),然後從父元素的值會指派給所有未指派的子項目,屬性系統。Property value inheritance in this context means that if there are child elements with no other value for ClipToBounds assigned through local values or styles, the value of the nearest parent element with this value assigned (again, either in styles, by default values, or a locally value), then the value from the parent element will be assigned to all unassigned child elements by the property system. 實際上這表示您可以指定是否要在根項目,允許裁剪界限,並將它做為值將會傳播至所有子項目具有不是明確地指派falseIn practice this means that you can specify whether to allow clip to bounds at the root element, and that value will propagate to all child elements that have not specifically assigned it as false.

相依性屬性資訊Dependency Property Information

識別項欄位Identifier field ClipToBoundsProperty
若要設定的中繼資料屬性 trueMetadata properties set to true None

適用於

另請參閱