Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Here is a Demo using MVVM approach</p> <h1>ViewModel</h1> <pre><code>public class AccountListViewModel : INotifyPropertyChanged { ICommand AddAccountCommand {get; set;} public AccountListViewModel() { AccountList = new ObservableCollection&lt;string&gt;(); AddAccountCommand= new RelayCommand(AddAccount); //Fill account List saved data FillAccountList(); } public AddAccount(object obj) { AccountList.Add(AccountName); //Call you Model function To Save you lIst to DB or XML or Where you Like SaveAccountList() } public ObservableCollection&lt;string&gt; AccountList { get {return accountList} ; set { accountList= value OnPropertyChanged("AccountList"); } } public string AccountName { get {return accountName } ; set { accountName = value OnPropertyChanged("AccountName"); } } } </code></pre> <h1>Xaml Binding</h1> <pre><code>&lt;ListBox ItemsSource="{Binding Path=AccountList}" Height="164" HorizontalAlignment="Left" Margin="12" Name="accountListBox" VerticalAlignment="Top" Width="161" /&gt; &lt;TextBox Text={Binding Path=AccountName}&gt;&lt;/TextBox&gt; &lt;Button Command={Binding Path=AddAccountCommand}&gt;&lt;Button&gt; </code></pre> <h1>Xaml.cs Code</h1> <pre><code> # region Constructor /// &lt;summary&gt; /// Default Constructor /// &lt;/summary&gt; public MainView() { InitializeComponent(); this.DataContext = new AccountListViewModel(); } # endregion </code></pre> <p>The Implementation of <code>INotifyPropertyChanged</code> and forming porpeties is left upto you</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload