private static void OnSelectedItemPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) { EditedCombobox control = (EditedCombobox)sender; DicDataModel model = (DicDataModel)e.NewValue; control.ChangeSelectedItem(model); }
public void AddOrder(int count, string msg) { try { var model = new DicDataModel { ID = count, Data = msg }; TCPConnection.Instance.SendData("FB" + JsonConvert.SerializeObject(model)); } catch { } }
public void SendMessage(int id, string message) { try { var model = new DicDataModel { ID = id, Data = message }; TCPConnection.Instance.SendData("FA" + JsonConvert.SerializeObject(model)); } catch { } }
private void cbxData_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (cbxData.SelectedIndex < 0) { txtDefault.Visibility = Visibility.Visible; txtData.Text = ""; } else { txtDefault.Visibility = Visibility.Collapsed; txtData.Text = cbxData.SelectedItem.ToString(); if (cbxData.SelectedIndex < Items.Count()) { SelectedItem = Items[cbxData.SelectedIndex]; } } }
private void ChangeSelectedItem(DicDataModel model) { txtData.Visibility = Visibility.Visible; txtDefault.Visibility = Visibility.Collapsed; txtData.Text = model.Data; }