private void UpdateExistLotList()
{
using (var db = new DDataContext())
{
//Grabs the lot_number column from db that is distinct
var ExistLot = db.LotInformation.First(l => l.lot_number.Equals(LotNumber));
}
}
This method has no para?
But you call it like this?
{
lotNumList = value;
RaisePropertyChanged("LotNumList");
UpdateExistLotList(LotNumber);
}
Is there something wrong?
Your question is that UpdateExistLotList
was never called?
Try to add a breakpoint on RaisePropertyChanged("LotNumList");
in VisualStudio and observe why it doesn't get called.
In your code, I don't know the use of ExistLot
and LotNumber
.
I guess your demand is like this?
Comobox shows LotInformation, select one LotInformation and make datagrid shows LotInformation.Components ?
If so,you can Binding DataGrid's Itemsource={Binding Components,ElementName=ComboboxName}
or you can Binding Combobox's SelectedItem/SelectedValue, and then set ComponentsList in these events.
Get your demand.
You means you don't set a relationship between Components and LotInformation in EntityFramework or other DB framework.
If you use EF, I advise you make a relationship between Components and LotInformation,and then you can get ComponentsList by LotInformation.Components
.
In another way, try like this:
<ComboBox HorizontalAlignment="Left"
Margin="125,110,0,0"
VerticalAlignment="Top"
Width="120"
DisplayMemberPath="lot_number"
SelectedItem="{Binding SelectedLot}"
ItemsSource="{Binding LotNumList}"
RenderTransformOrigin="0.583,2" Height="18" />
private LotInformation selectedLot;
public LotInformation SelectedLot
{
get { return selectedLot; }
set
{
selectedLot = value;
var lot = value as LotInformation;
if (lot != null)
{
ComponentsList = new List<Components>();
//add ComponentsList
}
}
}