国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > C# > 正文

WPF中的ListBox實現按塊顯示元素的方法

2020-01-24 00:59:27
字體:
來源:轉載
供稿:網友

本文實例講述了WPF中的ListBox實現按塊顯示元素的方法。分享給大家供大家參考,具體如下:

注意:需要設置ListBox的屬性 ScrollViewer.HorizontalScrollBarVisibility="Disabled"

關鍵代碼,WPF中有內置的WrapPanel控件,在ListBox.ItemsPanel中使用可以讓元素按塊顯示

<ListBox.ItemsPanel>    <ItemsPanelTemplate>      <WrapPanel/>    </ItemsPanelTemplate></ListBox.ItemsPanel>
<ListBox Height="304" HorizontalAlignment="Left" Margin="14,143,0,0" Name="lstTables" VerticalAlignment="Top" Width="615" ScrollViewer.HorizontalScrollBarVisibility="Disabled" >  <ListBox.ItemsPanel>    <ItemsPanelTemplate>      <WrapPanel/>    </ItemsPanelTemplate>  </ListBox.ItemsPanel>  <ListBox.ItemTemplate>    <DataTemplate>      <Grid Margin="20,20,20,20">        <Grid.RowDefinitions>          <RowDefinition></RowDefinition>          <RowDefinition></RowDefinition>          <RowDefinition></RowDefinition>        </Grid.RowDefinitions>        <Image Source="Images/table.png" Grid.Row="0" Height="42" Width="42" HorizontalAlignment="Center">          <Image.Effect>            <DropShadowEffect/>          </Image.Effect>        </Image>        <TextBlock Text="{Binding FTableName,Mode=TwoWay}" Grid.Row="1" HorizontalAlignment="Center" Margin="5,5,5,5" />        <CheckBox IsChecked="{Binding FSelected,Mode=TwoWay,Converter={StaticResource SelCTS}}" Grid.Row="2" HorizontalAlignment="Center">          <CheckBox.Effect>            <DropShadowEffect/>          </CheckBox.Effect>        </CheckBox>      </Grid>    </DataTemplate>  </ListBox.ItemTemplate></ListBox>

更多關于C#相關內容感興趣的讀者可查看本站專題:《C#窗體操作技巧匯總》、《C#常見控件用法教程》、《WinForm控件用法總結》、《C#程序設計之線程使用技巧總結》、《C#操作Excel技巧總結》、《C#中XML文件操作技巧匯總》、《C#數據結構與算法教程》、《C#數組操作技巧總結》及《C#面向對象程序設計入門教程

希望本文所述對大家C#程序設計有所幫助。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 克什克腾旗| 河间市| 江源县| 博爱县| 宁陕县| 河源市| 通辽市| 大姚县| 集贤县| 繁昌县| 雷山县| 沙雅县| 昌乐县| 河南省| 文成县| 正安县| 常德市| 邛崃市| 分宜县| 育儿| 腾冲县| 界首市| 阿图什市| 安西县| 博爱县| 新宁县| 田阳县| 彰化市| 阿城市| 舟山市| 雅安市| 浮梁县| 桂东县| 泗洪县| 涟水县| 浮山县| 福建省| 韶山市| 千阳县| 东丽区| 枝江市|