弄了个ComboBox下拉菜单{0,1,...,7}然后我想通过在下拉菜单中选择一项数值在Label控件显示出来,达到数据同步的效果。请问怎么实现啊?
还有怎么获取系统时间啊?我想一起在Label控件中显示出来。comboboxwpflabel控件绑定
还有怎么获取系统时间啊?我想一起在Label控件中显示出来。comboboxwpflabel控件绑定
解决方案 »
- 大家好,请问.NET FRAME兼容问题。
- 自定义了个combobox想在单击其他的地方的时候关闭下拉框
- 请教一下关于高手c#调用外部DLL的方法的问题,谢谢
- 关于Assembly的疑问,向各位大虾求教!
- [属性(property)]问题
- 求ASP.NET的一个电子商务系统的教程
- 一个很久以前就在CSDN请教过的dataGrid问题!!一直都没有很好的解决!!希望大家在帮帮我!谢谢!!
- winform绑定数据窗口, 关联表添加新记录的问题.
- 如何添加一个属性,这个属性是一个枚举。
- 大侠,怎么在datagrid里面加一个checkbox呀...
- 多次读取xml文件数据不会重新绑定,求解答!
- 请教一个关于用C#操作EXCEL的问题
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="3*" />
</Grid.RowDefinitions>
<Label Content="{Binding ElementName=comb, Path=SelectedValue.Content, Mode=OneWay}" />
<ComboBox Grid.Row="1" Height="23" HorizontalAlignment="Left" Width="120" Name="comb" >
<ComboBoxItem Content="1" />
<ComboBoxItem Content="2" />
<ComboBoxItem Content="3" />
<ComboBoxItem Content="4" />
<ComboBoxItem Content="5" />
<ComboBoxItem Content="6" />
<ComboBoxItem Content="7" />
</ComboBox>
</Grid>
</Window>
public class Axonia
{
public string axoniaID { set; get; }
public string tWeight { set; get; }
} public class AxoniaArr : ObservableCollection<Axonia>
{
public AxoniaArr()
{
this.Add(new Axonia { tWeight = "6t", axoniaID = "0" });
this.Add(new Axonia { tWeight = "10t", axoniaID = "1" });
this.Add(new Axonia { tWeight = "10t", axoniaID = "2" });
this.Add(new Axonia { tWeight = "14t", axoniaID = "3" });
this.Add(new Axonia { tWeight = "18t", axoniaID = "4" });
this.Add(new Axonia { tWeight = "12t", axoniaID = "5" });
this.Add(new Axonia { tWeight = "22t", axoniaID = "6" });
this.Add(new Axonia { tWeight = "0t", axoniaID = "7" });
}
}<Window x:Class="ComboBox_Binding_sample.W02"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="W02" Height="130" Width="270"
xmlns:c="clr-namespace:ComboBox_Binding_sample">
<Window.Resources>
<c:AxoniaArr x:Key="ec"/>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<ComboBox Width="160" Height="25" x:Name="TBAxonia" FontSize="14" ItemsSource="{StaticResource ec}" DisplayMemberPath="axoniaID" SelectedValuePath="tWeight"> <Label Background="#FFFFFFFF" x:Name="TB" Width="160" Height="25" BorderThickness="1,1,1,1" Content="{Binding ElementName=TBAxonia,Path=SelectedValue}"/> </Grid>
</Window>