List view selection change is one of interesting matter in WPF. When you will select the item from list view. It will automatically fill field of the corrosponding item. Consider the following Selection change Event:
private void unitNamelistView_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (unitNamelistView.SelectedIndex > -1)
{
/*====Setting Selected item in Entity=====*/
EUnitMeasurement seletedUnit = (EUnitMeasurement)unitNamelistView.SelectedItem;
/*==== Filling UI Field From entity======*/
unitIDtextBox.Text = seletedUnit.Id;
unitAbbrivationtextBox.Text = seletedUnit.UnitName;
fullNameUnittextBox.Text = seletedUnit.FullNameOfUnit;
unitCommenttextBox.Text = seletedUnit.UnitComment;
}
}
Enjoy....!!
private void unitNamelistView_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (unitNamelistView.SelectedIndex > -1)
{
/*====Setting Selected item in Entity=====*/
EUnitMeasurement seletedUnit = (EUnitMeasurement)unitNamelistView.SelectedItem;
/*==== Filling UI Field From entity======*/
unitIDtextBox.Text = seletedUnit.Id;
unitAbbrivationtextBox.Text = seletedUnit.UnitName;
fullNameUnittextBox.Text = seletedUnit.FullNameOfUnit;
unitCommenttextBox.Text = seletedUnit.UnitComment;
}
}
Enjoy....!!
thank you very much , press is good !
ReplyDelete