WPF Learning Path (12) control (Headeredcontent control)

Source: Internet
Author: User

GroupBox

A common control used to organize multiple controls, because it is a content space that can contain only one item directly, and requires the use of intermediate spaces of a panel type.

Header and content can be any element

<GroupBox> <GroupBox.Header> <wrappanel margin="5"> <image source=". \image\icon.png"></Image> <textblock text="Database List:"Fontsize=" -"/> </WrapPanel> </GroupBox.Header> <GroupBox.Content> <stackpanel textblock.fo Ntsize=" -"margin="5"> <textblock text="DB001"/> <textblock text="DB002"/> <textblock text="DB003"/> <textblock text="DB004"/> <textblock text="DB005"/> </StackPanel> </GroupBox.Content></GroupBox>

More content

Http://www.dotnetperls.com/groupbox-wpf

Https://msdn.microsoft.com/en-us/library/system.windows.controls.groupbox (v=vs.110). aspx

Expander

Similar to GroupBox, contains a button to expand or collapse content

<stackpanel margin="5"> <Expander> <Expander.Header> <wrappanel margin="2"> <image source=". \image\icon.png"height=" -"></Image> <textblock text="Database List:"></TextBlock> </WrapPanel> </Expander.Header> <Expander.Content> <stackpanel textblock.fontsize=" the"> <textblock text="DB001"/> <textblock text="DB002"/> <textblock text="DB003"/> <textblock text="DB004"/> </StackPanel> </Expander.Content> </Expander> <expander expanddirection =" Left"> <Expander.Header> <wrappanel margin="2"> <image source=". \image\icon.png"height=" -"></Image> <textblock text="Database List:"></TextBlock> </WrapPanel> </Expander.Header> <Expander.Content> <stackpanel textblock.fontsize=" the"> <textblock text="DB001"/> <textblock text="DB002"/> </StackPanel> </Expander.Content> </Expander> <expander expanddirection =" Right"> <Expander.Header> <wrappanel margin="2"> <image source=". \image\icon.png"height=" -"></Image> <textblock text="Database List:"></TextBlock> </WrapPanel> </Expander.Header> <Expander.Content> <stackpanel textblock.fontsize=" the"> <textblock text="DB001"/> <textblock text="DB002"/> </StackPanel> </Expander.Content> </Expander> <expander expanddirection =" up"> <Expander.Header> <wrappanel margin="2"> <image source=". \image\icon.png"height=" -"></Image> <textblock text="Database List:"></TextBlock> </WrapPanel> </Expander.Header> <Expander.Content> <stackpanel textblock.fontsize=" the"> <textblock text="DB001"/> <textblock text="DB002"/> </StackPanel> </Expander.Content> </Expander></StackPanel>
View Code

Simplifying code

Create a Expanderdemo class

 Public Partial class expanderdemo:expander{    public  Expanderdemo ()    {        InitializeComponent ();    }}
<expander x:class="Alex_wpfcontrol.expanderdemo"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="Http://schemas.microsoft.com/winfx/2006/xaml"> <Expander.Header> <wrappanel margin="2"> <image source=". \image\icon.png"height=" -"></Image> <textblock text="Database List:"></TextBlock> </WrapPanel> </Expander.Header> <Expander.Content> &LT;STACKP Anel textblock.fontsize=" the"> <textblock text="DB001"/> <textblock text="DB002"/> </StackPanel> </Expander.Content></Expander>

Window.xaml

<StackPanel>    <local:expanderdemo/>    <local:expanderdemo expanddirection="  left" />    <local:expanderdemo expanddirection="right" />    <local:expanderdemo expanddirection="up" /></stackpanel>

More content

http://blog.csdn.net/tcjiaan/article/details/6970200

Https://msdn.microsoft.com/en-us/library/system.windows.controls.expander (v=vs.110). aspx

To be continue ...

WPF Learning Path (12) control (Headeredcontent control)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.