Guest User

Untitled

a guest
Jul 17th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.87 KB | None | 0 0
  1. <ListBox Margin="5" x:Name="RemoveLookup" ItemsSource="{Binding Path=LocationObjectResults}">
  2. <ListBox.ItemTemplate>
  3. <DataTemplate>
  4. <Grid Height="60" Loaded="Grid_Loaded">
  5. <Grid.ColumnDefinitions>
  6. <ColumnDefinition Width="20*"/>
  7. <ColumnDefinition Width="12*"/>
  8. <ColumnDefinition Width="12*"/>
  9. <ColumnDefinition Width="12*"/>
  10. <ColumnDefinition Width="12*"/>
  11. <ColumnDefinition Width="10*"/>
  12. <ColumnDefinition Width="10*"/>
  13. </Grid.ColumnDefinitions>
  14. <Border x:Name="lblID" Grid.Column="0" Style="{StaticResource CustomDisplayBorder}">
  15. <TextBlock Style="{StaticResource CustomDisplayText}" Text="{Binding Path=ID}" />
  16. </Border>
  17. <Border Name="lblLocation" Grid.Column="1" Style="{StaticResource CustomDisplayBorder}">
  18. <TextBlock Text="{Binding Path=Location}" Style="{StaticResource CustomDisplayText}"/>
  19. </Border>
  20. <Border Name="lblItemNum" Grid.Column="2" Style="{StaticResource CustomDisplayBorder}">
  21. <TextBlock Text="{Binding Path=ItemNum}" Style="{StaticResource CustomDisplayText}"/>
  22. </Border>
  23. <Border Name="lblQuantity" Grid.Column="3" Style="{StaticResource CustomDisplayBorder}">
  24. <TextBlock Text="{Binding Path=LotCode}" Style="{StaticResource CustomDisplayText}"/>
  25. </Border>
  26. <Border Name="lblLotCode" Grid.Column="4" Style="{StaticResource CustomDisplayBorder}">
  27. <TextBlock Text="{Binding Path=Quantity}" Style="{StaticResource CustomDisplayText}"/>
  28. </Border>
  29. <Border Name="lblFillDate" Grid.Column="5" Style="{StaticResource CustomDisplayBorder}">
  30. <TextBlock Text="{Binding Path=FillDate}" Style="{StaticResource CustomDisplayText}"/>
  31. </Border>
  32. </Grid>
  33. </DataTemplate>
  34. </ListBox.ItemTemplate>
  35. </ListBox>
  36.  
  37. public RemoveViewModel()
  38. {
  39. if (!IsInDesignMode)
  40. {
  41.  
  42. }
  43. else
  44. {
  45. _locationObjectResults.Add(new LocationObject()
  46. {
  47. ID = "test",
  48. Location = "test2",
  49. ItemNum = "123123",
  50. LotCode = "123123123",
  51. Quantity = "500",
  52. FillDate = DateTime.Now
  53. });
  54. }
  55. }
  56.  
  57. public ObservableCollection<LocationObject> LocationObjectResults
  58. {
  59. get
  60. {
  61. return this._locationObjectResults;
  62. }
  63. set
  64. {
  65. this._locationObjectResults = value;
  66. base.RaisePropertyChanged(() => this.LocationObjectResults);
  67. }
  68. }
  69.  
  70. public void PopulateLocationObjects()
  71. {
  72. //var itemList = new ObservableCollection<LocationObject>()
  73. // {
  74. // new LocationObject("test1","test2","test3","500","123123",DateTime.Now)
  75. // };
  76. _locationObjectResults.Add(new LocationObject()
  77. { ID = "test",
  78. Location = "test2",
  79. ItemNum = "123123",
  80. LotCode = "123123123",
  81. Quantity = "500",
  82. FillDate = DateTime.Now
  83. });
  84. base.RaisePropertyChanged(() => this.LocationObjectResults);
  85. }
  86.  
  87. private static bool? isInDesignMode;
  88.  
  89. public bool IsInDesignMode
  90. {
  91. get
  92. {
  93. if (!isInDesignMode.HasValue)
  94. {
  95. isInDesignMode = DesignerProperties.IsInDesignTool;
  96. }
  97. return isInDesignMode.Value;
  98. }
  99. }
  100.  
  101. protected void RaisePropertyChanged<T>(Expression<Func<T>> propertyExpression)
  102. {
  103. if (propertyExpression.Body.NodeType == ExpressionType.MemberAccess)
  104. {
  105. var memberExpr = propertyExpression.Body as MemberExpression;
  106. string propertyName = memberExpr.Member.Name;
  107. this.OnPropertyChanged(propertyName);
  108. }
  109. }
  110.  
  111. <UserControl.Resources>
  112. <viewModels:RemoveViewModel x:Key="ViewModel" />
  113. </UserControl.Resources>
  114.  
  115. <Grid x:Name="LayoutRoot" Loaded="LayoutRoot_Loaded" DataContext="{Binding Source={StaticResource ViewModel}}">
  116.  
  117. <ListBox Margin="5" x:Name="RemoveLookup" ItemsSource="{Binding Path=LocationObjectResults Mode=TwoWay}">
Add Comment
Please, Sign In to add comment