/// <summary> /// When the handle is created, get the history from isolated storage. /// </summary> /// <param name="e"></param> private void ComboBox_HandleCreated(object sender, EventArgs e) { if (DesignMode) { return; } _uniqueName = this.GetFullyQualifiedName(); var vt = new Shared.ValuesTracker(_uniqueName); vt.Load(); var history = vt.GetValue<List<string>>(ValueKey, new List<string>()); history = history.Distinct().ToList(); Items.AddRange(history.ToArray()); }
/// <summary> /// When the control is destroyed, save the items to isolated storage. /// </summary> /// <param name="e"></param> private void ComboBox_HandleDestroyed(object sender, EventArgs e) { if (!DesignMode) { var vt = new Shared.ValuesTracker(_uniqueName); var history = new List<string>(Items.Count); history.AddRange(Items.Cast<string>().Distinct()); vt.AddValue<List<string>>(ValueKey, history); vt.Save(); } }