網站首頁 編程語言 正文
1.GroupBox
注意: GroupBox仍然需要布局容器來放置元素。如: StackPanel面板
<GroupBox Header="select number?"> <StackPanel> <RadioButton>one</RadioButton> <RadioButton>two</RadioButton> <RadioButton>three</RadioButton> </StackPanel> </GroupBox>
2.TabControl
像這種標簽頁控件, 在winform種非常常見, Tabpge子頁面, 而在WPF種, 對應的則是TabItem類。
所示的代碼示意圖:
<TabControl> <TabItem Header="首頁"> <StackPanel> <Button>button1</Button> <Button>button2</Button> <Button>button3</Button> </StackPanel> </TabItem> <TabItem Header="第二頁"> <StackPanel> <Button>button4</Button> <Button>button5</Button> <Button>button6</Button> </StackPanel> </TabItem> </TabControl>
與Content屬性相同, TabItem的Header同樣可以接收任何類型的對象。這意味著可以創建一個組合框或選項卡。在他們的頁標題中包含任意圖形和任意元素。如下所示:
<TabControl> <TabItem > <TabItem.Header> <StackPanel Orientation="Horizontal"> <Button Background="Transparent" BorderBrush="Transparent">?</Button> <TextBox BorderBrush="Transparent">首頁</TextBox> </StackPanel> </TabItem.Header> <StackPanel> <Button>button1</Button> <Button>button2</Button> <Button>button3</Button> </StackPanel> </TabItem> </TabControl>
3.Expander菜單控件
具備標題的內容收縮控件, 在web中很普遍, 用于左側菜單。
代碼如下所示:
<StackPanel> <Expander Header="One" Margin="5" Padding="5"> <TextBlock TextWrapping="Wrap">Ofo has been favored by the public, even the foreign people speak highly of it. These yellow bikes can be found everywhere, so the people who are in a hurry can use it and then reached the destination in time.</TextBlock> </Expander> <Expander Header="Two" Margin="5" Padding="5"> <TextBlock TextWrapping="Wrap">Especially for the visitors, they can ride these bikes and then have a look at the scenery around.</TextBlock> </Expander> <Expander Header="Three" Margin="5" Padding="5"> <TextBlock TextWrapping="Wrap">It can saves them a lot of money and the most important thing is the convenience it brings.</TextBlock> </Expander> </StackPanel>
4.ListBox控件
ListBox控件是一個非常靈活的控件, 它不僅包含子元素ListBoxItem對象。而且也可以駐留其他元素, 這也就是ListBoxItem類繼承于ContentControl類,從而ListBoxItem能夠包含一段嵌套的內容。
例如, 創建一個包含普通按鈕的列表。如下所示:
<StackPanel> <ListBox> <ListBoxItem> <Button>? button1</Button> </ListBoxItem> </ListBox> <ListBox> <ListBoxItem> <Button>? button2</Button> </ListBoxItem> </ListBox> <ListBox> <ListBoxItem> <Button>? button3</Button> </ListBoxItem> </ListBox> </StackPanel>
5. ProgressBar進度條
IsIndeterminate屬性設置為True, 控件則會周期性的顯示一個綠色(默認)從左到右的脈沖。
<Grid> <ProgressBar IsIndeterminate="True" Height="30"></ProgressBar> </Grid>
當然, 我們也可以通過修改Foreground 屬性, 修改其滾動的顏色。如下所示
<StackPanel> <ProgressBar Margin="2" IsIndeterminate="True" Height="30" Foreground="Green" ></ProgressBar> <ProgressBar Margin="2" IsIndeterminate="True" Height="30" Foreground="Red" ></ProgressBar> <ProgressBar Margin="2" IsIndeterminate="True" Height="30" Foreground="Chocolate" ></ProgressBar> <ProgressBar Margin="2" IsIndeterminate="True" Height="30" Foreground="DarkSalmon" ></ProgressBar> <ProgressBar Margin="2" IsIndeterminate="True" Height="30" Foreground="Pink" ></ProgressBar> <ProgressBar Margin="2" IsIndeterminate="True" Height="30" Foreground="DodgerBlue" ></ProgressBar> </StackPanel>
6.日期控件
WPF中有兩個日期控件,Calendar和DatePicker, 前者是以一個日歷的形式, 后者則像是一個文本框的形式。
<StackPanel> <DatePicker></DatePicker> <Calendar></Calendar> </StackPanel>
同時, 控件還具備眾多屬性。
DisplayDateStart 和 DisplayDateEnd |
設置在日歷視圖中顯示的日期范闈,從第一個妯早的日期(DisplayDateStart)到最后最近 的日期(DisplayDateEnd),用戶不能導航到沒打包含能夠顯示的日期的月份。為了顯示所 有日期,可以將DisplayDateStart屬性設置為DateTime.MinValue,并將DisplayDateEnd W性設置為DateTime.MaxValue |
?BlackoutDates |
保存在日歷中將被禁用或不能選擇的日期集合?如果這呰日期不在可以顯示的曰期范ra 內,或芥如果己經選擇了這些曰期中的蓯個日期,將接收到一個異常, 為了阻止選擇任 何過去的日期,可以調用BlackoutDates.AddDatcsInPast()方法 |
?SelectedDate |
作為一個DateTime對象提供選擇的日期(或名?沒冇日期被選中時使用null值)。可以通過 代碼、通過單擊日歷中的日期、或通過用戶鍵入一個日期字符審(在DatePicker控件中> 設置該屬性.在日歷視圖中,選抒的日期使用一個具有陰影的方框標識,只有當曰期控 件具有焦點時才會顯示該方框 |
?SelectedDates | ?作為 DateTime 對象的集合提供選擇的日期。 Calcndar 控件支持該屬性,并目.只有當修改了 SelectionMode 屬性,以允許選擇多個日期時,該屬性才有用 |
?DispalyDate | ?(使用Datetime 對象確定在日歷視圖中最初顯示的日期.如果該屬性為空,顯示selectedDate屬性的值。如果 DisPlayDate 和 select 曰 LDate 屬性均為空,使用當前日期.顯示的日期決定了日歷視圖中最初的月份頁面。當日期控件具有焦點時,在該月份中恰當的某天周圍顯示一個方形邊框(該邊框和用于當前選擇日期的陰影方框是有區別的) |
?FristDayOfweek | ?確定在日歷中每行的開始位置(最左邊)顯示一星期中的哪一天 |
?IsToDayHighighted | ?確定日歷視圖是否通過突出顯示指出當前日期 |
原文鏈接:https://www.cnblogs.com/zh7791/p/9014957.html
相關推薦
- 2022-08-15 常見哈希算法、Hmac算法和BouncyCastle
- 2022-09-08 Go語言怎么使用變長參數函數_Golang
- 2022-05-26 openwrt安裝docker并啟動的操作方法_docker
- 2023-11-16 【電腦Windows日常】解決Windows11 無法顯示office圖標的問題
- 2023-07-15 css 多余部分用省略號代替
- 2022-11-17 C#實現表格數據轉實體的示例代碼_C#教程
- 2022-08-18 win10同網段/跨網段訪問虛擬機samba服務器的過程記錄_服務器其它
- 2022-08-29 Python?GUI?圖形用戶界面_python
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支