Part 1: Create button and status
TheCodeDownload from here
-
- Download and open the project
Use the above linkDownloadAndOpenProject to prepare for the tutorial.
You should see the scenario shown in.
-
- Select a graph to create a button
- SelectCalledButtonGrid
- SelectTools> production buttons...This will openCreate a style ResourceDialog box.
- Enter the name (key)Redbuttonstyle.
These steps will create a new button control, a style called redbuttonstyle applied to it.
-
- How to add text size
- Under the button selected, change the size and width of the text to 14px and bold respectively.
-
- 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.
- When the new button is selected,Click breadcrumb barTo display the menu, and then selectEdit control part (Template)> edit Template.
- Define the state of the mouse over it
Let's make the button bigger when Mouseover occurs:
- SelectCommonstatesUnderMouseoverStatus.
- Now select the name in the element treeButton.
- ChangeScalingToX = 1.1,Y = 1.1.
- Define the press status
For press status, let's change the circle color:
- SelectPressStatus.
- SelectButtonInGridInEllipse_0.
- 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.
- Create other buttons
Now that we have redbuttonstyle, we can apply it to other buttons. Let's start creating other buttons...
- ClickBreadcrumb barIn[Button]LeaveTemplate editingMode.
- InToolbarSelectButton.
- 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.
- Apply styles to other buttons
Now we use resources to change the style of these new buttons.
- OpenResourcesPanel.
- Expand[Usercontrol]To view available styles.
- 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.
-
- Text of the change button
All of the above have the same text: "button ". Let's change it.
- SelectThe first button we created.
- InAttributePanelCommon PropertiesUnderContentIn this example, I changed"Go".
Repeat Step 2 to change the text of other buttons.
- One style controls all buttons
If we change the style on one button, the style on all other buttons will also be updated.
- 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.
- ChangeDefault deformation interval commonstatesUp to 0.2.
If you run the program again,All buttonsWill change to 0.2 S.