I'm using WPF C#
I want to show DisplayMemberPath and SelectedValuePath in a Combobox item but when the user clicked on one of the Combobox items, then on the Combobox selected item showing just SelectedValue
My Model:
public partial class CST
{
public string Tafcode { get; set; }//ID
public string Esm { get; set; }//Name
public string Shoy => $"{Tafcode} {Esm}";
}
CS :
var quer_ITM = dbms.Database.SqlQuery<CST>("SELECT Tafcode , Esm FROM CST").ToList();
cmb.ItemsSource = quer_ITM;
cmb.DisplayMemberPath = "Shoy"; //Merg of Esm + Tafcode
cmb.SelectedValuePath = "Tafcode";//The Primary Key 112-1-1
XAML:
<ComboBox x:Name="cmb" Margin="0,312,202,0" VerticalAlignment="Top" Height="22" FlowDirection="RightToLeft" FontFamily="/Negin;component/NT/#IRANSans" IsEditable="True" Background="#FFCCFFFF" HorizontalAlignment="Right" Width="402">
</ComboBox>
I have no error in the up lines, just I don't know how to do that
Please Help ?