wpf C#.net中的组合框面临的问题 [英] Facing Problem with combobox in wpf C#.NET

查看:57
本文介绍了wpf C#.net中的组合框面临的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在组合框的选择更改事件中使用ComboboxName.SelectedItem代码时,i将获得先前选择的值.我用数据表绑定了组合框.

<ComboBox x:Name="ActieComboBox" Grid.Column="1" Grid.Row="4" Margin="2" ItemsSource="{Binding Source={StaticResource ProjectTaakCategorieViewSource}}" ItemTemplate="{StaticResource ProjectTakenComboBoxItemTemplate}" SelectedValuePath="TaakCategorieId" SelectedValue="{Binding CategorieId,Mode=TwoWay}" />



重要的是,selectedValue使用双向绑定


i gets previously selected value when using ComboboxName.SelectedItem code in selection changed events of the combobox. i used datatable to bind combobox.

解决方案

Since this question is rather vague I''ll post an example combobox of mine :

<ComboBox x:Name="ActieComboBox" Grid.Column="1" Grid.Row="4" Margin="2" ItemsSource="{Binding Source={StaticResource ProjectTaakCategorieViewSource}}" ItemTemplate="{StaticResource ProjectTakenComboBoxItemTemplate}" SelectedValuePath="TaakCategorieId" SelectedValue="{Binding CategorieId,Mode=TwoWay}" />



Important stuff is that the selectedValue uses twoway binding


这篇关于wpf C#.net中的组合框面临的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆