Use the coding4fun button control in WP7)

Source: Internet
Author: User

Address: http://windowsphonegeek.com/articles/Getting-Started-with-Coding4Fun-Button-Controls

In this article, I will discuss in detail the button control in the coding4fun toolkit. This section describes the main features and existing public APIs, and provides examples of different situations.

Note: a year ago I published the "WP7 roundtogglebutton and roundbutton in depth" Article, and there were no significant changes in the previous releases.

The coding4fun toolkit provides the roundbutton and roundtogglebutton controls. roundtogglebutton is a UI component derived from the checkbox control and exposes some additional dependency attributes, as it is called. This is an extended round switch button with support for Automatic reverse image. The roundbutton control is a circular extension button that provides automatic reverse image support.

Before using the roundbutton and roundtogglebutton controls, we need to addCoding4fun. Phone. Controls. dllReferences

You can download : Coding4fun Toolkit

Step 1: add the prefix declaration of "c4f" to ensure that your page declares the namespace of "c4ftoolkit.

Xmlns: c4f = "CLR-namespace: coding4fun. Phone. controls; Assembly = coding4fun. Phone. Controls"

<C4f: roundbutton/>

<C4f: roundtogglebutton/>

The roundtogglebutton control inherits all attributes and events from the checkbox. The roundbutton control inherits all attributes and events from the button control.

ContentAttribute

This attribute is used by the parent user to set roundtogglebutton/roundbutton.

ImagesourceAttribute

Imagesource is a dependency attribute of the imagesource type. You can set or obtain roundtogglebutton/roundbutton.
Widget Image

OrientationAttribute

Orientation is a dependency attribute of the orientation type. It is used to set or obtain the roundtogglebutton
/Roundbutton control direction

Examples

In the following example, I will use two icons

 

Note: The icons automatically change according to the theme changes of light.

Example1:RoundbuttonExample

This example shows how to set common attributes of the roundbutton control and add the following XAML code.

<Stackpanel orientation = "horizontal">

<C4f: roundbutton fontsize = "18" content = "OK" borderbrush = "cornflowerblue"/>

<C4f: roundbutton fontsize = "48" content = "48" background = "cornflowerblue"/>

<C4f: roundbutton foreground = "cornflowerblue" fontsize = "36" content = "36"/>

<C4f: roundbutton imagesource = "images/appbar.delete.rest.png" content = "delete"/>

</Stackpanel>

The following are the results in Dark and Light themes.

Example2:
Roundbutton orientation and imagesourceAttribute usage

<C4f: roundbutton orientation = "horizontal" imagesource = "images/appbar.feature.search.rest.png" content = "horizontal text"/>

Example3. roundtogglebuttonControl example

This example demonstrates how to setRoundtogglebuttonControl common attributes, add the following XAML code

<Stackpanel orientation = "horizontal">

<C4f: roundtogglebutton fontsize = "18" content = "OK" borderbrush = "cornflowerblue"/>
<C4f: roundtogglebutton fontsize = "48" content = "48" background = "cornflowerblue"/>
<C4f: roundtogglebutton foreground = "cornflowerblue" fontsize = "36" content = "36"/>

<C4f: roundtogglebutton imagesource = "images/appbar.delete.rest.png" content = "delete"/>

</Stackpanel>

Example4:Roundtogglebutton orientation and imagesourceAttribute usage

<C4f: roundtogglebutton orientation = "horizontal" imagesource = "images/appbar.feature.search.rest.png" content = "horizontal text"/>

Example5:Roundbutton and RoundtogglebuttonDisable controls

<C4f: roundbuttonX: Name = "BTN"Isenabled = "false"Orientation = "horizontal"Imagesource = "images/appbar.delete.rest.png"

Content = "disabled button"/>

 

SlaveCoding4fun ToolkitIn-depth understandingRoundbutton/roundtogglebuttonControl.Download source code:C4fbuttons

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.