我有一個組合框,用int表示年代。這些年我將它們添加到一個ObservableCollection,但我的問題是,當我加載項目默認情況下,組合框的空白。我想爲它設置一個默認名稱,比如「年」,但我不希望解決方案將isEditable設置爲true,或者在開始處插入字符串。我想要一個純xaml解決方案,如果它是可行的。將默認名稱設置爲WPF中的組合框
這是我當前的XAML文件:
<RSControls:SmoothScrollComboBox Grid.Column="1" x:Name="compilationYearCombo" Margin="7,2.04,0,2.04"
SelectedValue="{Binding Path=SelectedYear}"
SelectedValuePath=""
ItemsSource="{Binding Years}"
DisplayMemberPath="" SelectionChanged="compilationYearCombo_SelectionChanged" IsSynchronizedWithCurrentItem="True" Grid.ColumnSpan="2" IsEditable="False" SelectedIndex="0" IsReadOnly="False" Text="Years">
</RSControls:SmoothScrollComboBox>
我嘗試添加一個<TextBlock Text="Years" />
,但只有改變了所有的元素組合爲「年」。
我apreciatte細節explenation如何,我只是一個WPF的初學者。
謝謝。
請問這是[SO問題](http://stackoverflow.com/questions/1426050/how-to-display-default-text-select-team-in-combo-box-on-pa geload-in-wpf)的幫助? –
確實重複 – V4Vendetta
我試過這個解決方案,但我不知道那是什麼CultureInfo參數是... – Kobe