Make a summary of sliverlight learned today
Style Classification in Sliverlight: 1, built-in style 2, global style
1. built-in style: the so-called built-in style is to add attributes directly after the control. This method usually causes page confusion.
2. Global style: similar to the css style in asp.net, for example, defined in app. xaml
<Style x: Key = "firstSty" TargetType = "Button">
<Setter Property = "FontSize" Value = "15"> </Setter>
<Setter Property = "FontFamily" Value = ""> </Setter>
<Setter Property = "Foreground" Value = "Red"> </Setter>
<Setter Property = "Background" Value = "Silver"> </Setter>
</Style>
The style can be referenced in the button control on the xaml page.
<Button Content = "firsttext" Canvas. Left = "30" Canvas. Top = "120" Height = "25"
Foreground = "Black"
Background = "Azure"
FontSize = "14"
Style = "{StaticResource firstSty }"
>
</Button>
If the built-in style conflicts with the global style, select the nearby style.
3, RadioButton
There are two groups of RadioButton on the page. The first group is the favorite animal, and the second group is the favorite food. When you put it on the same page, the other group is empty, in this case, we need to separate the two groups of RadioButton:
A. place two groups of RadioButton in different grids. B. Change the GroupName of the two groups of RadioButton.
4. Implement Session in sliverlight
Sliverlight runs on the client, so it can only simulate the session and use static classes and static methods to simulate the role of the session.
Private static Dictionary <string, object> session = new Dictionary <string, object> ();
Public static Dictionary <string, object> Session
{
Get {return SessionManager. session ;}
Set {SessionManager. session = value ;}
}
5. Controls in sliverlight
All control classes in Silverlight are subclasses of FrameworkElement (which provides the basic elements of Silverlight Layout features, and FrameworkElement adds more layout functions). The relationships between control derived classes are different, they can be divided into the following categories:
A. Panel controls: these controls are derived from Panel controls, such as Canvas, Grid, StackPanel, and InkPresenter controls.
B. Content Control: these controls are derived from the ContentControl class and provide the Content attribute for customizing the control Content, such as buttons, RadioButton, HyperlinkButton, RepeatButton, CheckBox, and ScrollViewer controls.
C. List controls: these controls are derived from the ItemsControl class and are often used to display data sets, such as ComboBox, ListBox, and TabControl controls.
D. common controls: they are directly derived from the Control class. Custom Controls are often derived from the Control class, such as TextBox, PasswordTextBox, Canlendar, DataGrid, DataPicker, ProgressBar, ScrollBar, Slider control, etc,
E. Other controls: these controls are not derived from the Control class, but directly derived from the FrameworkElement class, such as TextBlock, Border, Image, MediaElement, and Popup controls.