This kind of effect is very common. When a user clicks an option or button on the page, a window is displayed, and other parts of the window are masked with translucent colors, and editing is not allowed.
Use Silverlight to make a summary:
1. Create a newwindow. XAML file. The default value is Code As follows: < Usercontrol X: Class = " Silverlightdemo. detailview "
Xmlns = " Http://schemas.microsoft.com/client/2007 "
Xmlns: x = " Http://schemas.microsoft.com/winfx/2006/xaml "
>
< Grid >
</ Grid >
</ Usercontrol >
2. Add a rectangle to the grid and set the opacity (transparency) and fill (fill color) attributes, as shown below:<Rectangle opacity="0.8"Fill="Lightgray"/>
3. the following content is what you want to display. I will show him a textblock and a close button as follows: < Border cornerradius = " 30 " Background = " # Ff5c7890 " Width = " 600 " Height = " 250 " >
< Stackpanel >
< Grid margin = " 30 " >
< Textblock text = " {Binding firstname} " Foreground = " White " Fontsize = " 20 " />
< Button content = " Close " Click = " Button_click " Width = " 50 " Height = " 30 " />
</ Grid >
</ Stackpanel >
</ Border >
4. The click method of the close button is as follows, that is, the visibility value is set as follows:Private void button_click (Object sender, routedeventargs E)
{
Visibility = visibility. collapsed;
}
5. OK, newwindow. the XAML file is here. You only need to use it in the file to be masked. Here I am on page. in the XAML file, click the button to bring up the mask. therefore:
First, introduce the namespace, which depends on your project. Here is:Xmlns: app="CLR-namespace: silverlightdemo"
then directly go to page. insert the custom control newwindow Into The XAML page. Remember to set the visibility attribute to collapsed so that it will not pop up during page loading. app: detailview X: name = " detailview " grid. rowspan = " 2 " visibility = " collapsed " />
Set the visibility value to visible in the Click Event of the button. The form is as follows: Private void button1_onclick (Object sender, routedeventargs e ){
Detailview. Visibility=Visibility. visible;
}
I have talked a lot about it, but it is actually a very simple problem!