This is the eighth article in the series, which describes the use of style elements in Silverlight to encapsulate control impressions
Silverlight supports a Style mechanism that allows us to encapsulate the property values of a control into reusable resources. We can store these style declarations in separate files from the page, and then reuse them across controls and pages in one application (or even reuse across multiple applications). In a basic customization scenario, it's conceptually similar to reusing CSS in HTML.
inline style
Inline style This concept is actually the same as the style of the elements we specify in the HTML, set by attributes in XAML, as in the following XAML, we added two buttons and set the font style in it:
<Canvas Background="#46461F">
<Button Width="200" Height="60" Background="Red"
Canvas.Top="90" Canvas.Left="30" Content="提 交"
FontFamily="微软雅黑"
FontSize="24"
FontWeight="Bold"
Foreground="Green"/>
<Button Width="200" Height="60" Background="Red"
Canvas.Top="90" Canvas.Left="260" Content="取 消"
FontFamily="微软雅黑"
FontSize="24"
FontWeight="Bold"
Foreground="Red"/>
</Canvas>
The results of the run display are as follows: