Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <ListBox Margin="5" x:Name="RemoveLookup" ItemsSource="{Binding Path=LocationObjectResults}">
- <ListBox.ItemTemplate>
- <DataTemplate>
- <Grid Height="60" Loaded="Grid_Loaded">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="20*"/>
- <ColumnDefinition Width="12*"/>
- <ColumnDefinition Width="12*"/>
- <ColumnDefinition Width="12*"/>
- <ColumnDefinition Width="12*"/>
- <ColumnDefinition Width="10*"/>
- <ColumnDefinition Width="10*"/>
- </Grid.ColumnDefinitions>
- <Border x:Name="lblID" Grid.Column="0" Style="{StaticResource CustomDisplayBorder}">
- <TextBlock Style="{StaticResource CustomDisplayText}" Text="{Binding Path=ID}" />
- </Border>
- <Border Name="lblLocation" Grid.Column="1" Style="{StaticResource CustomDisplayBorder}">
- <TextBlock Text="{Binding Path=Location}" Style="{StaticResource CustomDisplayText}"/>
- </Border>
- <Border Name="lblItemNum" Grid.Column="2" Style="{StaticResource CustomDisplayBorder}">
- <TextBlock Text="{Binding Path=ItemNum}" Style="{StaticResource CustomDisplayText}"/>
- </Border>
- <Border Name="lblQuantity" Grid.Column="3" Style="{StaticResource CustomDisplayBorder}">
- <TextBlock Text="{Binding Path=LotCode}" Style="{StaticResource CustomDisplayText}"/>
- </Border>
- <Border Name="lblLotCode" Grid.Column="4" Style="{StaticResource CustomDisplayBorder}">
- <TextBlock Text="{Binding Path=Quantity}" Style="{StaticResource CustomDisplayText}"/>
- </Border>
- <Border Name="lblFillDate" Grid.Column="5" Style="{StaticResource CustomDisplayBorder}">
- <TextBlock Text="{Binding Path=FillDate}" Style="{StaticResource CustomDisplayText}"/>
- </Border>
- </Grid>
- </DataTemplate>
- </ListBox.ItemTemplate>
- </ListBox>
- public RemoveViewModel()
- {
- if (!IsInDesignMode)
- {
- }
- else
- {
- _locationObjectResults.Add(new LocationObject()
- {
- ID = "test",
- Location = "test2",
- ItemNum = "123123",
- LotCode = "123123123",
- Quantity = "500",
- FillDate = DateTime.Now
- });
- }
- }
- public ObservableCollection<LocationObject> LocationObjectResults
- {
- get
- {
- return this._locationObjectResults;
- }
- set
- {
- this._locationObjectResults = value;
- base.RaisePropertyChanged(() => this.LocationObjectResults);
- }
- }
- public void PopulateLocationObjects()
- {
- //var itemList = new ObservableCollection<LocationObject>()
- // {
- // new LocationObject("test1","test2","test3","500","123123",DateTime.Now)
- // };
- _locationObjectResults.Add(new LocationObject()
- { ID = "test",
- Location = "test2",
- ItemNum = "123123",
- LotCode = "123123123",
- Quantity = "500",
- FillDate = DateTime.Now
- });
- base.RaisePropertyChanged(() => this.LocationObjectResults);
- }
- private static bool? isInDesignMode;
- public bool IsInDesignMode
- {
- get
- {
- if (!isInDesignMode.HasValue)
- {
- isInDesignMode = DesignerProperties.IsInDesignTool;
- }
- return isInDesignMode.Value;
- }
- }
- protected void RaisePropertyChanged<T>(Expression<Func<T>> propertyExpression)
- {
- if (propertyExpression.Body.NodeType == ExpressionType.MemberAccess)
- {
- var memberExpr = propertyExpression.Body as MemberExpression;
- string propertyName = memberExpr.Member.Name;
- this.OnPropertyChanged(propertyName);
- }
- }
- <UserControl.Resources>
- <viewModels:RemoveViewModel x:Key="ViewModel" />
- </UserControl.Resources>
- <Grid x:Name="LayoutRoot" Loaded="LayoutRoot_Loaded" DataContext="{Binding Source={StaticResource ViewModel}}">
- <ListBox Margin="5" x:Name="RemoveLookup" ItemsSource="{Binding Path=LocationObjectResults Mode=TwoWay}">
Add Comment
Please, Sign In to add comment