1. Add a new window in expression blend and set the attribute: allowstransparency = true, windowstyle = none, windowstartuplocation = centerscreen
Set the Alpha value of the window to 0 to make the original window transparent.
2. Delete the default grid element, add a border element from the toolbox, and set the attributes of border:
Cornerradius = "10, 10, 10" borderthickness = "8, 8, 8" background = "# ffffffff" borderbrush = "# cc000000"
3. Add a sub-border for border and set its attributes:
Cornerradius = "8, 8, 8" background = "#99 ffffff"
4. Add a grid element for the second border, and then add two rows for the grid:
Set the height of the first row to auto, and the height of the second row to * (1 star)
5. continue adding child elements:
Closewindowbutton is a custom button used to close a window.
6. My custom window is as follows:
However, this window cannot do anything. You cannot move the window position with the mouse or close the window directly. You also need to add some background information for her.Code
7. Add event processing code for windowtitlelabel and closewindowbutton:
Add code in:
Private void windowtitlelabel_mouseleftbuttondown (Object sender, mousebuttoneventargs E)
{
This. dragmove ();
}
Private void closewindowbutton_click (Object sender, routedeventargs E)
{
This. Close ();
}
This is a success. Now, press and hold the title bar of the window to drag the window and click the close button to close the window.