I have got a list view which populates my chart of accounts:
public class ChartOfAccounts
{
public int AccountCode { get; set; }
public string AccountTitle { get; set; }
public string Description { get; set; }
public string SubCategory { get; set; }
public string Category { get; set; }
public bool Active { get; set; }
}
Through this list view, I want to populate other controls like:
private void MainRadDataGrid_SelectionChanged(object sender, Telerik.UI.Xaml.Controls.Grid.DataGridSelectionChangedEventArgs e)
{
RadDataGrid rdg = (RadDataGrid)sender;
var SelectedCOA = (ChartOfAccounts)rdg.SelectedItem;
if (rdg !=null && rdg.SelectedItems.Count > 0) {
AccountCodeTextBox.Text = SelectedCOA.AccountCode.ToString();
AccountTitleTextBox.Text = SelectedCOA.AccountTitle;
DescriptionTextBox.Text = SelectedCOA.Description;
CategoryComboBox.SelectedItem = SelectedCOA.Category;
SubCategoryComboBox.SelectedItem = SelectedCOA.SubCategory;
}
}
The problem is, that I could not set the Category
and SubCategory
Comboboxes to the related Category
and SubCategory
. ComboBox only shows Category
and Sub Category
word, not the actual selected item.
Can anyone explains why this is not working?