コンボボックスがあり、AccountType クラスを使用してリストにデータが入力され、リストに適切にデータが入力されています。
ただし、選択したアイテムのプロパティをクラス アカウントである選択したアカウントにバインドすると。ページの読み込み時に、選択したアイテムが更新されません。テキストボックスなどの他のすべてのコントロールが更新されています。
どんな助けでも大歓迎です。
意見
ComboBox ItemsSource="{Binding AllAccountTypes}" DisplayMemberPath="AccountTypeName"
SelectedValuePath="AccountTypeName" SelectedItem="{Binding SelectedAccount}" />
AccountType クラス
public class AccountType:IAccountType
{
public string AccountTypeName { get; set; }
}
アカウント クラス
public class Account: IAccount
{
public int AccountNo { get; set; }
public string AccountName { get; set; }
public string AccountTypeName { get; set; }
public int SubAccount { get; set; }
public string Description { get; set; }
public double Balance { get; set; }
public string Note { get; set; }
public bool Active { get; set; }
}
ViewModel で選択したアカウント
public IAccount SelectedAccount { get { return selectedAccount; }
set { selectedAccount = value; }
}