Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.30 KB | None | 0 0
  1. <DataGridTemplateColumn Header="Валюта">
  2. <DataGridTemplateColumn.CellTemplate>
  3. <DataTemplate>
  4. <TextBlock Text="{Binding Path=ExchangeRates.Title}"/>
  5. </DataTemplate>
  6. </DataGridTemplateColumn.CellTemplate>
  7. <DataGridTemplateColumn.CellEditingTemplate>
  8. <DataTemplate>
  9. <ComboBox ItemsSource="{Binding Path=DataContext.ExchangeRates,
  10. RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}"
  11. SelectedItem="{Binding Path=ExchangeRates, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
  12. DisplayMemberPath="Title" IsSynchronizedWithCurrentItem="True"/>
  13. </DataTemplate>
  14. </DataGridTemplateColumn.CellEditingTemplate>
  15. </DataGridTemplateColumn>
  16.  
  17. /*ExchangeRates коллекция для ComboBox
  18. Тут была попытка получить элемент из коллекции и потом его поставить в качестве выбранного(не помогло)
  19. ModelModul.ExchangeRates ex = ExchangeRates.Single(objEx =>
  20. objEx.Id == product.ExchangeRates.Id);
  21. ExchangeRates.Contains(ex) хотя тут вернул true*/
  22. PurchaseInfos.Add(new PurchaseInfos
  23. {
  24. Products = new Products
  25. {
  26. Barcode = product.Barcode,
  27. Groups = product.Groups,
  28. //ExchangeRates = ex,
  29. ExchangeRates = product.ExchangeRates,
  30. Id = product.Id,
  31. IdExchangeRate = product.IdExchangeRate,
  32. IdGroup = product.IdGroup,
  33. IdUnitStorage = product.IdUnitStorage,
  34. IdWarrantyPeriod = product.IdWarrantyPeriod,
  35. PurchasePrice = product.PurchasePrice,
  36. SalesPrice = product.SalesPrice,
  37. VendorCode = product.VendorCode,
  38. UnitStorages = product.UnitStorages,
  39. WarrantyPeriods = product.WarrantyPeriods,
  40. Title = product.Title,
  41. SerialNumbers = new ObservableCollection<SerialNumbers>()
  42. },
  43. IdProduct = product.Id,
  44. IdExchangeRate = product.IdExchangeRate,
  45. ExchangeRates = product.ExchangeRates
  46. });
  47.  
  48. public override bool Equals(Object obj)
  49. {
  50. if (obj == null || !GetType().Equals(obj.GetType()))
  51. {
  52. return false;
  53. }
  54. return Id == ((ExchangeRates)obj).Id &&
  55. Title == ((ExchangeRates)obj).Title && Course == ((ExchangeRates)obj).Course;
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement