当前位置: 首页 > news >正文

最好用的cmsseo网络排名优化哪家好

最好用的cms,seo网络排名优化哪家好,适合医药公司做网站的图片,网站二级域名是什么为 ListView 控件的内容指定视图模式的方法,参考官方文档。 ComboBox 样式和模板 案例说明:通过checkBox和ComboBox的组合方式实现下拉窗口的多选方式,同时说明了ListView中Items项目的两种绑定方式. 示例: 设计样式 Xaml代码…

为 ListView 控件的内容指定视图模式的方法,参考官方文档。

ComboBox 样式和模板

案例说明:通过checkBox和ComboBox的组合方式实现下拉窗口的多选方式,同时说明了ListView中Items项目的两种绑定方式.

示例:

设计样式

Xaml代码 

<Window x:Class="ComboBox自定义多选.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:d="http://schemas.microsoft.com/expression/blend/2008"xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"xmlns:local="clr-namespace:ComboBox自定义多选"xmlns:hc="https://handyorg.github.io/handycontrol"        mc:Ignorable="d"Title="MainWindow"Height="450"Width="800"Background="DarkGray"><Grid><Grid.ColumnDefinitions><ColumnDefinition Width="300"></ColumnDefinition><ColumnDefinition></ColumnDefinition></Grid.ColumnDefinitions><StackPanel><!-- 定义多选ComboBox --><ComboBox Name="multiSelectComboBox"Width="200"Height="30"HorizontalAlignment="Left" IsEditable="True"StaysOpenOnEdit="True"IsReadOnly="True"Text="多选列表"Margin="10"><!-- 定义ComboBox的ItemTemplate,包含一个CheckBox --><ComboBox.ItemTemplate><DataTemplate><CheckBox Content="{Binding Name}"IsChecked="{Binding IsSelected, Mode=TwoWay}" /></DataTemplate></ComboBox.ItemTemplate></ComboBox><!-- 按钮显示所选项目 --><Button Content="查看选择了什么选项"Width="170"Height="30"VerticalAlignment="Top"HorizontalAlignment="Left"Margin="10"Click="ShowSelectedOptions_Click" /><TextBlock Name="SelectItems"Margin="10"></TextBlock></StackPanel><WrapPanel Grid.Column="1"><ListView Name="StudentList" Margin="10"><ListView.View><GridView><GridViewColumn Header="姓名"                                        Width="200"DisplayMemberBinding="{Binding Name}"></GridViewColumn><GridViewColumn Header="年龄"Width="200"DisplayMemberBinding="{Binding Age}"></GridViewColumn></GridView></ListView.View></ListView><Button Name="Mode1"Margin="10"HorizontalAlignment="Left"Content="方式一"Click="Mode1_Click"></Button><Button Name="Mode2"Margin="10"HorizontalAlignment="Left"Content="方式二"Click="Mode2_Click"></Button></WrapPanel></Grid>
</Window>

CS代码 

using System.Collections.ObjectModel;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;namespace ComboBox自定义多选
{/// <summary>/// Interaction logic for MainWindow.xaml/// </summary>public partial class MainWindow : Window{public ObservableCollection<Student> Items { get; set; }public MainWindow(){InitializeComponent();// 初始化选项集合Items = new ObservableCollection<Student>{new Student { Name = "张三", Age = "20"},new Student { Name = "李四", Age = "21"},new Student { Name = "王五", Age = "22"},new Student { Name = "赵六", Age = "23"}};// 将Items集合绑定到ComboBox的ItemsSourcemultiSelectComboBox.ItemsSource = Items;           }// 显示已选择的选项private void ShowSelectedOptions_Click(object sender, RoutedEventArgs e){// 获取所有IsSelected为true的项目var selectedItems = Items.Where(item => item.IsSelected).Select(item => item.Name).ToList();// 显示选择的项目SelectItems.Text = "你选择了: " + string.Join(", ", selectedItems);}// 数据项类public class Student{public string? Name { get; set; }public string? Age {  get; set; }public bool IsSelected { get; set; }}private void Mode1_Click(object sender, RoutedEventArgs e){StudentList.Items.Clear();// 初始化选项集合Items = new ObservableCollection<Student>{new Student { Name = "张三", Age = "20"},new Student { Name = "李四", Age = "21"},new Student { Name = "王五", Age = "22"},new Student { Name = "赵六", Age = "23"}};// 将Items集合绑定到ListView的ItemsSourceStudentList.ItemsSource = Items;}private void Mode2_Click(object sender, RoutedEventArgs e){StudentList.ItemsSource = null;StudentList.Items.Clear();StudentList.Items.Add(new Student { Name = "孙悟空", Age = "10000" });StudentList.Items.Add(new Student { Name = "悟能", Age = "5000" });StudentList.Items.Add(new Student { Name = "悟净", Age = "3000" });StudentList.Items.Add(new Student { Name = "唐僧", Age = "30" });}}
}

使用效果展示

启动页面

点击“方式一”

点击“方式二”

查看多选框的下拉菜单

 选择两个项目

点击“查看选择了什么选项”

http://www.khdw.cn/news/59260.html

相关文章:

  • 邢台做网站的那好国内打开google网页的方法
  • 加强网站建设和维护工作如何引流与推广
  • 做网站营业执照经营范围怎么填写软件培训
  • 新建网站如何让百度收录网上营销怎么做
  • 黑客黑网站是做网站如何统计网站访问量
  • 百事通做网站网站关键词有哪些
  • 做网站网页的软件是绿色的图标什么河南公司网站建设
  • 成立网站要多少钱巢湖网站制作
  • app推广放单平台西宁网站seo
  • 那个网站做图片怎么样在百度上免费推广
  • 30_10_郑州网站制作缅甸今日新闻
  • 注册域名 不建网站百度竞价排名怎么靠前
  • 做网站虚拟主机哪里有潍坊网站外包
  • 滨海县建设局网站十大教育培训机构排名
  • 网站架构文案友情链接有哪些展现形式
  • 两个人能用的一个公司做网站吗十大免费b2b网站
  • 伊春网站推广seo中文意思
  • 自己做网站自己做推广教程视频教程求个网站
  • meetsh网站建设百度经验首页登录官网
  • 江苏盐城疫情最新消息徐州百度快照优化
  • 如何搭建微商城免费推广seo
  • 关于网络营销的论文厦门关键词排名seo
  • 主色调为绿色的网站seo的作用有哪些
  • 上海网站制作公司多少钱搜索网站大全
  • 公司网站的留言板怎么做深圳小程序建设公司
  • 外贸网站虚拟空间深圳谷歌优化seo
  • 天河公司网站建设私域运营软件
  • seo获客seo外贸推广
  • 深圳市住房城乡建设局网站首页线上营销的优势和劣势
  • 第一模板网站上的模板怎么下载百度seo泛解析代发排名