private static void OnSelectedItemPropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs e) { LogTypeCombo control = source as LogTypeCombo; Core.Data.LogType t = e.NewValue as Core.Data.LogType; control.SelectedComboItem = t; }
public static Core.Data.LogType GetLogType(string keyWord) { Core.Data.LogType result = null; keyWord = keyWord.ToLower(); result = (from gt in ApplicationData.Instance.LogTypes where gt.Name.ToLower().Contains(keyWord) select gt).FirstOrDefault(); if (result == null) { //take special ID result = GetLogType(0); } return(result); }
public LogTypeCombo() { InitializeComponent(); _availableTypes = new ObservableCollection <Core.Data.LogType>(); if (Core.ApplicationData.Instance.LogTypes != null) { foreach (var c in Core.ApplicationData.Instance.LogTypes) { _availableTypes.Add(c); } } SelectedComboItem = SelectedItem; DataContext = this; }