Skip to content

Latest commit

 

History

History
20 lines (15 loc) · 1.17 KB

how-to-override-the-logical-tree.md

File metadata and controls

20 lines (15 loc) · 1.17 KB
title ms.date helpviewer_keywords ms.assetid description
How to: Override the Logical Tree
03/30/2017
overriding the logical tree [WPF]
logical tree [WPF], overriding
0ae4d074-8113-4b06-b4fa-e0f39d4967a6
Learn how to subclass StackPanel to override the logical tree and enforce a behavior that the panel may only have and will only render a single child element.

How to: Override the Logical Tree

Although it is not necessary in most cases, advanced control authors have the option to override the logical tree.

Example

This example describes how to subclass xref:System.Windows.Controls.StackPanel to override the logical tree, in this case to enforce a behavior that the panel may only have and will only render a single child element. This isn't necessarily a practically desirable behavior, but is shown here as a means of illustrating the scenario for overriding an element's normal logical tree.

[!code-csharpLogicalOverride#SingletonPanel]

For more information on the logical tree, see Trees in WPF.