WPF Combobox数据绑定Binding
2021-04-24 03:26
标签:microsoft isp stc 取值 new generic 分享图片 txt 选择 combobox数据绑定List链表集合区分显示值与选择的值 整体效果: 根据combobox选择情况分别打印选取值与显示值 代码: Windows窗体: 用于绑定combobox的类 WPF Combobox数据绑定Binding 标签:microsoft isp stc 取值 new generic 分享图片 txt 选择 原文地址:http://www.cnblogs.com/yilinyangyu/p/7987981.html 1 Window x:Class="ComboxBinding.MainWindow"
2 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4 Title="ComBox绑定" Height="192.857" Width="385" WindowStartupLocation="CenterScreen" Loaded="Window_Loaded">
5 Grid>
6 ComboBox Name="comBox1" HorizontalAlignment="Left" Margin="74,10,0,0" Width="209" Height="22" VerticalAlignment="Top"/>
7 TextBlock Name="txtSelectedValue" Width="200" Text="{Binding ElementName=comBox1, Path=SelectedValue}" HorizontalAlignment="Left" Margin="115,58,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Background="#FFE7FBFA"/>
8 TextBlock Name="txtSelectedText" Width="200" Text="{Binding ElementName=comBox1, Path=Text}" HorizontalAlignment="Left" Margin="114,88,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Background="#FFE7FBFA"/>
9 Label Content="selectedValue" HorizontalAlignment="Left" Margin="2,58,0,0" VerticalAlignment="Top"/>
10 Label Content="selectedText" HorizontalAlignment="Left" Margin="10,86,0,0" VerticalAlignment="Top"/>
11
12 Grid>
13 Window>
1 using System.Collections.Generic;
2 using System.Windows;
3
4 namespace ComboxBinding
5 {
6 ///
1 namespace ComboxBinding
2 {
3 ///
文章标题:WPF Combobox数据绑定Binding
文章链接:http://soscw.com/index.php/essay/78758.html