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

首頁 > 編程 > C# > 正文

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

2019-10-29 21:21:05
字體:
來源:轉載
供稿:網友

本文實例講述了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#教程頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 天长市| 灯塔市| 博爱县| 晴隆县| 信阳市| 玉树县| 海盐县| 德庆县| 凌海市| 鄱阳县| 定州市| 宝应县| 阿合奇县| 重庆市| 天镇县| 顺昌县| 南平市| 延长县| 澄迈县| 紫金县| 随州市| 霍城县| 读书| 宝丰县| 安阳县| 永年县| 嵩明县| 沛县| 卫辉市| 鸡泽县| 临城县| 布拖县| 和龙市| 塔河县| 祁门县| 鹤峰县| 凤台县| 抚远县| 元江| 怀化市| 涞水县|