VB.NET Decorators in WPF: Part 1

In this article you will learn about the decorators in WPF.
  • 2285

Decorators: The all content controls like ScrollViewer, GroupBox, Expander are very helpful tools to make an effective WPF application these al are designing tools. There is one type or you can say branch of container is available in WPF which is use to perform graphical changes on an object. These branch of container is also called the Elements of the container and the WPF call these Decorators.

The System.Windows.Controls.Decorator is provide the functionality to all the decorators. All the decorators are derive from this. Generally all decorators are used for designing and working with controls. In WPF we use many decorators like ButtonChorme decorator is used with button to change its shape and background, one more decorators is ListBoxChorme decorator, it is used with ListBox.

For better and deep understanding I explain two main decorator of WPF. That's two general decorators are Border and Viewbox.

Border: We use Border to display a border around your content, and for that we must place the elements within a parent Border element. Border can have only one child. To display multiple child elements, you need to place an additional panel element within the parent Border. You can then place child elements within that panel element.

Example of Border Decorator

<Window x:Class="MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="350" Width="525">
    <Border Margin="5" Padding="5" Background="LightYellow"
BorderBrush="Blue" BorderThickness="5,5,6,5" CornerRadius="3"
VerticalAlignment="Top">
        <StackPanel>
            <Button Margin="3">Manish</Button>
            <Button Margin="3">sapna</Button>
            <Button Margin="3">Tewatia</Button>
            <Button Margin="3">Beniwal</Button>
        </StackPanel>
    </Border>
</
Window>

Output Window

border1.gif

Conclusion

Hope this article helps you to understand the Decorators in WPF.

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.