public SubstitutionVM() { this.HopVarities = Hop.loadHopVarities(); this._Selection1 = this.HopVarities.Keys.First(); this._Selection2 = this.HopVarities.Keys.Last(); AlphaAcid1 = this.HopVarities[this._Selection1].AlphaAcid; AlphaAcid2 = this.HopVarities[this._Selection2].AlphaAcid; RaisePropertyChanged("AlphaAcid1"); RaisePropertyChanged("AlphaAcid2"); RaisePropertyChanged("HopSelection1"); RaisePropertyChanged("HopSelection2"); }
public EditHop() { InitializeComponent(); //load the hops varities for the dropdown and set them this._HopVarities = Hop.loadHopVarities(); this._SelectedItem = this._HopVarities.Keys.First(); hopVarityPicker.ItemsSource = this._HopVarities.Keys; this.DataContext = this; this._HopItem = PhoneApplicationService.Current.State["EditItem"] as Hop; float alphaAcid = this._HopItem.AlphaAcid; //otherwise will be overwritten by setting SelectedItem this._SelectedItem = this._HopItem.Name; NotifyPropertyChanged("SelectedItem"); this._HopItem.AlphaAcid = alphaAcid; NotifyPropertyChanged("AlphaAcid"); NotifyPropertyChanged("Amount"); NotifyPropertyChanged("BoilTime"); }