工作我試圖通過下面的代碼來設置選定的項目,但它不工作:將selectedItem沒有在XAML
<StackPanel Orientation="Horizontal">
<TextBlock Text="Sort by" Margin="10" VerticalAlignment="Center"/>
<ComboBox Width="{StaticResource ComboWidth}" x:Name="sortcombo" ItemsSource="{Binding Path=SortOrder}" SelectionChanged="SearchCombo_SelectionChanged" SelectedItem="{Binding Path=DefaultSortIndex}">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=Sort}"/>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</StackPanel>
不過,如果我使用的selectedIndex用,而不是綁定到第0指數正常工作。任何聲明錯誤?
嘗試使您的selecteditem的綁定方式TwoWay – Natrium 2013-03-22 12:05:33
它沒有工作。 – Ankit 2013-03-22 12:27:29