General steps to bind a WPF element to a CLR Element

Source: Internet
Author: User

// 1. selected WPF element: This selects an ellipse (elliptical) object <br/> ellipse uiobject = new ellipse (); </P> <p> // 2. selected CLR element: This selects a location (two-dimensional coordinate) object <br/> location position = new location (); </P> <p> // 3. select the property to be bound to the WPF element: the canvas of ellipse is selected. left additional attribute </P> <p> // 4. select the property to be bound to the CLR element: select the property X of location </P> <p> // 5. set binding details </P> <p> // 5. 1. instantiate the binding class <br/> binding bindingleftproperty = new binding (); </P> <p> // 5. 2. specify the specific parameters of the bound object, and set the source and its property path (represented by a string) <br/> bindingleftproperty. source = position; <br/> bindingleftproperty. path = new propertypath ("X"); </P> <p> // 5. 3. set binding mode: Select twoway <br/> bindingleftproperty. mode = bindingmode. twoway; </P> <p> // 6. bind and associate <br/> uiobject. setbinding (canvas. leftproperty, bindingleftproperty );

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.