WPF Bind binding ElementName Path

Source: Internet
Author: User

One: {Binding elementname=grid0, path=height}

elementname=grid0: Find the name of the GRID0 control.

A path=height: gets The Height property value of the control named grid0 .

namely: the the Lb1 property value is set to sets the value of the Grid0 control's height property.

    <GridName= "GRID0">        <Grid>            <StackPanelBackground= "AliceBlue">                <BorderHorizontalAlignment= "Left"Height= "+"Cursor= "Hand"Panel.zindex= "2">                    <LabelContent= "Back"HorizontalAlignment= "Left"MouseLeftButtonUp= "Label_mouseleftbuttonup"></Label>                </Border>                <BorderVerticalAlignment= "Top"Margin= "0,-30,0,0">                    <Label name= "LB1"Content= "123"horizontalcontentalignment= "Center"verticalcontentalignment= "Center"Height="{Binding elementname=grid0, path=height}"FontSize= "+"FontFamily= "Microsoft Jas Black"></Label>                </Border>            </StackPanel>        </Grid>    </Grid>

II: {StaticResource Labelpanelstyle}

Loads a style with the x:key property value equal to labelpanelstyle and a type of lable loaded into the current style (lable)

<usercontrol.resources>    <Stylex:key= "Labelpanelstyle"TargetType="{x:type Label}">        <Setter Property= "Foreground"Value= "White"/>   </Style></usercontrol.resources><Grid>    <Labelx:name= "Bordercontrol"FontFamily= "Microsoft Jas Black"FontSize= " the"Background= "#FF62A0CA"Content= "123"Style="{StaticResource Labelpanelstyle}"></Label></Grid>

WPF Bind binding ElementName Path

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.