//no use anymore private void BullnoseComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { System.Diagnostics.Debug.WriteLine("ComboBox_SelectionChanged"); if (((sender as ComboBox).DataContext as LengthItem).Type == null) { LengthItem source = ((sender as ComboBox).DataContext as LengthItem); LengthItem length = new LengthItem(); length.Length = source.Length; length.Type = new Bullnose((sender as ComboBox).SelectedValue.ToString()); (sender as ComboBox).DataContext = length; //((sender as ComboBox).DataContext as LengthItem).Type = new Bullnose( // (sender as ComboBox).SelectedValue.ToString()); } }
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (values.Length > 1) { if (values[0] is LengthItem && values[1] is ObservableCollection <LengthItem> ) { LengthItem item = values[0] as LengthItem; ObservableCollection <LengthItem> collection = values[1] as ObservableCollection <LengthItem>; return("L" + (collection.IndexOf(item) + 1).ToString()); } if (values[0] is WorkItem && values[1] is ObservableCollection <WorkItem> ) { WorkItem item = values[0] as WorkItem; ObservableCollection <WorkItem> collection = values[1] as ObservableCollection <WorkItem>; return((collection.IndexOf(item) + 1).ToString() + "."); } } //throw new NotImplementedException(); return(null); }