私はコンボボックスを持っており、XAMLのコンボボックスをviewmodel辞書値でバインドしています。コンボボックスアイテムソースのリロードをトリガーする方法
初めてページが読み込まれるときに、辞書値をサーバーからダウンロードし、辞書ビューモデル変数に設定しようとしています。
しかし、コンボボックスは、ビューモデル変数が更新され、コンボボックスのリロードをトリガーすることになってthatsのと起きていないthatsのため、これはなぜ起こるか私は理解していない空に見えます... FYI
: 私はハードコーディングしている場合辞書ではなく、私はこの問題 が表示されていないサーバーからダウンロードする私はページ秒の時間をロードすると、私はこの問題に
が表示されていない更新
XAML
<ComboBox x:Name=“testBox” Margin=“0,0,0,0” PlaceholderText="{StaticResource testText}” ItemsSource="{Binding TestDictionary.Values}” SelectedValue="{Binding DictionaryValue, Mode=TwoWay}" IsEnabled="{Binding IsItLoading, Converter={StaticResource InverseBooleanConverter}}"/>
ビューモデル
private Dictionary<string, string> testDictionary;
public Dictionary<string, string> TestDictionary
{
get
{
if (this.testDictionary == null)
{
this.testDictionary = new Dictionary<string, string>();
}
return this.testDictionary;
}
set
{
this.Set(() => this.TestDictionary, ref this.testDictionary, value);
}
}
あなたは 'ViewModel'と' XAML'を投稿して、どのようにデータをコンボボックスに割り当てることができますか? – AVK
@AVK - 問題のコードサンプルを更新しました –