wpf学习笔记---初识xaml标签语言
生活随笔
收集整理的這篇文章主要介紹了
wpf学习笔记---初识xaml标签语言
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
最近下載了windows sdk,也來湊下熱鬧學學新技術。順便也簡單的記錄下學習過程.此非教程.由于剛接觸,一切皆以實用為主.先了解其特性為好.
一.xaml的結構為xml形式組成,與flex中的標簽語言很相似.這個是比html好的地方,不寫廢話了.寫些實用的東西
二.XAML基本語法
1.根元素必須聲明命名空間,如
<Page?
??xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
??xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
??</Page>
2.聲明XAML控件(標簽)
<Button Content="Click Me"/>或<Button>Click Me</Button>
3.定義標簽屬性
<Button Background="Blue" Foreground="Red" Content="This is a button"/>
或
<Button>
??<Button.Background>
????<SolidColorBrush?Color="Blue"/>
??</Button.Background>
??<Button.Foreground>
????<SolidColorBrush?Color="Red"/>
??</Button.Foreground>
??<Button.Content>
????This?is?a?button
??</Button.Content>
</Button>
4.觸發事件
<Button Background="Blue" Click="OnClick" Content="This is a button"/>
void?OnClick(object?sender,?RoutedEventArgs?e)
{
???}
5.頁面跳轉
<Hyperlink NavigateUri="UriOfPageToNavigateTo.xaml">Navigate</Hyperlink> ? 第一篇還不知道寫些什么,先就這樣好了
一.xaml的結構為xml形式組成,與flex中的標簽語言很相似.這個是比html好的地方,不寫廢話了.寫些實用的東西
二.XAML基本語法
1.根元素必須聲明命名空間,如
<Page?
??xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
??xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
??</Page>
2.聲明XAML控件(標簽)
<Button Content="Click Me"/>或<Button>Click Me</Button>
3.定義標簽屬性
<Button Background="Blue" Foreground="Red" Content="This is a button"/>
或
<Button>
??<Button.Background>
????<SolidColorBrush?Color="Blue"/>
??</Button.Background>
??<Button.Foreground>
????<SolidColorBrush?Color="Red"/>
??</Button.Foreground>
??<Button.Content>
????This?is?a?button
??</Button.Content>
</Button>
4.觸發事件
<Button Background="Blue" Click="OnClick" Content="This is a button"/>
void?OnClick(object?sender,?RoutedEventArgs?e)
{
???}
5.頁面跳轉
<Hyperlink NavigateUri="UriOfPageToNavigateTo.xaml">Navigate</Hyperlink> ? 第一篇還不知道寫些什么,先就這樣好了
轉載于:https://www.cnblogs.com/Clingingboy/archive/2007/03/04/663273.html
總結
以上是生活随笔為你收集整理的wpf学习笔记---初识xaml标签语言的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: DataGrid分页使用小结
- 下一篇: 我的第一个ASP类(显示止一篇下一篇文章