1

「Category」のコレクションとして項目ソースが設定されたコンボ ボックスがあります。SelectedValuePath は CategoryID プロパティです。CategoryID を設定する整数である「DefaultCategory」をユーザー設定しています。コンボ ボックスで DefaultCategory ユーザー設定を選択できるようにします。

xmlns:my="clr-namespace:MyApp"

<ComboBox x:Name="cmbCategory" DisplayMemberPath="Category" SelectedValuePath="CategoryID" SelectedValue="{Binding Source={x:Static my:MySettings.Default}, Path=DefaultCategory, Mode=TwoWay}"/>
4

1 に答える 1

1

タイプがintでスコープがUserのDefaultCategory_Selectedという追加のアプリケーション設定を作成し、その設定にSelectedIndexプロパティをバインドできます。

<ComboBox SelectedIndex="{Binding Path=DefaultCategory_Selected, Mode=TwoWay}" ... />
于 2011-03-24T21:54:45.467 に答える