开发者

selected value combo box binding not working

I have a window control in which I am loading a wpf user control. The wpf user control contains a combo box which is bound to a property in the view model. When开发者_运维问答 I am debugging the code selected value property always has a value. When the control is loaded for the first time I am getting the selected value, but when I reload the control the combo box gets cleared. I tried everything; updating the source and other stuff, but it's still not working. I even set the datacontext in code behind, but am still not getting the expected output.

This is the XAML code:

<ComboBox x:Name="cmbType" Style="{StaticResource ComboBoxStyle}"       
 PreviewTextInput="cmbErrorType_PreviewTextInput" IsEditable="True"    
 MaxDropDownHeight="100" ItemsSource="{Binding Path=TypeList,Mode=OneWay}"    
 SelectedValue="{Binding Path=SelectedValue}" DisplayMemberPath="Id"     
 SelectedValuePath="Id" Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2"/> 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜