Nibblestutotials.net tutorial-create a button style for the silverlight2 series-1

Source: Internet
Author: User

Part 1: Create button and status

TheCodeDownload from here

  1. Download and open the project

    Use the above linkDownloadAndOpenProject to prepare for the tutorial.

    You should see the scenario shown in.

     

  2. Select a graph to create a button

    1. SelectCalledButtonGrid
    2. SelectTools> production buttons...This will openCreate a style ResourceDialog box.
    3. Enter the name (key)Redbuttonstyle.

    These steps will create a new button control, a style called redbuttonstyle applied to it.

     

  3. How to add text size
    1. Under the button selected, change the size and width of the text to 14px and bold respectively.

     

  4. Edit button style

    Used as the new part of silverlight2Visual status ManagerFunction, You can edit the style of the control now. Let's take a look at how to edit the redbuttonstyle we created in the previous step.

    1. When the new button is selected,Click breadcrumb barTo display the menu, and then selectEdit control part (Template)> edit Template.

     

  5. Define the state of the mouse over it

    Let's make the button bigger when Mouseover occurs:

    1. SelectCommonstatesUnderMouseoverStatus.
    2. Now select the name in the element treeButton.
    3. ChangeScalingToX = 1.1,Y = 1.1.

 

    1. Define the press status

      For press status, let's change the circle color:

      1. SelectPressStatus.
      2. SelectButtonInGridInEllipse_0.
      3. Change the fill gradient color of the ellipse to light orange.

      This is done! Now you have a new button style. When a Mouseover or pressed event occurs, the status will be triggered. PressF5Run the applicationProgram, Or pressProject> Test Solution.

       

    2. Create other buttons

      Now that we have redbuttonstyle, we can apply it to other buttons. Let's start creating other buttons...

      1. ClickBreadcrumb barIn[Button]LeaveTemplate editingMode.
      2. InToolbarSelectButton.
      3. InCanvasUpperClick and dragTo draw some buttons. Make them square, because our button is a circle. Similarly, don't make them too small because it looks weird.

 

  1. Apply styles to other buttons

    Now we use resources to change the style of these new buttons.

    1. OpenResourcesPanel.
    2. Expand[Usercontrol]To view available styles.
    3. There is only one style:Redbuttonstyle.Click and drag redbuttonstyleTo a new button.ReleaseMouse. Selected from context menuStyle.

    This button looks like the first button we created. Repeat the preceding three steps to apply the style to the other buttons you just created.

     

  2. Text of the change button

    All of the above have the same text: "button ". Let's change it.

    1. SelectThe first button we created.
    2. InAttributePanelCommon PropertiesUnderContentIn this example, I changed"Go".

    Repeat Step 2 to change the text of other buttons.

     

  3. One style controls all buttons

    If we change the style on one button, the style on all other buttons will also be updated.

    1. SelectClick the first button.Breadcrumb BarInEllipse_0To edit the style again.
      Blend will remember the path of each edited object, which is why you can directly reach the appropriate style for the second time.
    2. ChangeDefault deformation interval commonstatesUp to 0.2.

      If you run the program again,All buttonsWill change to 0.2 S.

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.