I have 2 tables
Scan Table have [ScanId],[Name],[Mode]
Tags Table have [Name],[Description],[ScanRefId]FOREIGN KEY([ScanRefId])
while inserting data it working ok. but while updating I want to display selectedvalue/storedvalue (foreign key) in combobox. but combobox shows always first value of binding data. What am I Missing?
My XAML code is:
<ComboBox
x:Name="cbscanservice"
Style="{StaticResource MaterialDesignFloatingHintComboBox}"
ItemsSource="{Binding Scanvalues}"
SelectedValue="{Binding Scan}"
SelectedValuePath="Name"
DisplayMemberPath="Name"
FontSize="14"
Grid.Row="2"
IsEditable="False"
materialDesign:HintAssist.Hint="Scan Service"
Height="40"
Margin="0,0,0,20"
VerticalAlignment="Bottom">
</ComboBox>
///UpdateviewModel----code
public IEnumerable<DB.model.Scan> Scanvalues
{
get { return Getscans(); }
}
private IList<DB.model.Scan> Getscans()
{
_scann = new List<DB.model.Scan>();
foreach (var scanname in scanService.GetAll())
{
_scann.Add(scanname);
}
return _scann;
}
public DB.model.Scan Scan
{
get { return _scan; }
set
{
_scan = value;
OnPropertyChanged("Scan");
}
}