[WPF 学习] 8.极简ComboBox的内容模板
2021-03-13 12:32
阅读:685
标签:scrollbar ystemd string nav mamicode width nes direct path
一、设置内容模板如下
二、前端调用(xaml)
aaa bbb
三、代码调用(cs)
ComboBox cb = new ComboBox() { Background=Brushes.Red,BorderBrush=Brushes.Blue,BorderThickness=new Thickness(2)};
cb.Items.Add( new TextBox { Text = "aaa" ,Foreground=Brushes.White} );
cb.Items.Add(new TextBox { Text = "bbb", Foreground = Brushes.Green });
cb.SelectedIndex = 0;
cb.Template = Resources["ComboBoxTemplate1"] as ControlTemplate;
四、效果图如下
[WPF 学习] 8.极简ComboBox的内容模板
标签:scrollbar ystemd string nav mamicode width nes direct path
原文地址:https://www.cnblogs.com/catzhou/p/12546197.html
文章来自:搜素材网的编程语言模块,转载请注明文章出处。
文章标题:[WPF 学习] 8.极简ComboBox的内容模板
文章链接:http://soscw.com/index.php/essay/64116.html
文章标题:[WPF 学习] 8.极简ComboBox的内容模板
文章链接:http://soscw.com/index.php/essay/64116.html
评论
亲,登录后才可以留言!