|
public class ItemDetails : INotifyPropertyChanged
{
private string itemCode;
public string ItemCode
{
get
{
return itemCode;
}
set
{
itemCode = value;
RaisePropertyChanged("ItemCode");
}
}
private string itemName;
public string ItemName
{
get
{
return itemName;
}
set
{
itemName = value;
RaisePropertyChanged("ItemName");
}
}
private int itemID;
public int ItemID
{
get
{
return itemID;
}
set
{
itemID = value;
RaisePropertyChanged("ItemID");
}
}
} |
|
public class OrderDetails:INotifyPropertyChanged
{
private string selName;
public string SelName
{
get
{
return selName;
}
set
{
selName = value;
RaisePropertyChanged("SelName");
}
}
} |
|
public void PopulateItemDetails()
{
itemDetails = new ObservableCollection<ItemDetails>();
itemDetails.Add(new ItemDetails() { ItemName = "SfDatagrid", ItemID = 01, ItemCode = "AAA" });
itemDetails.Add(new ItemDetails() { ItemName = "SfCellGrid", ItemID = 02, ItemCode = "AAB" });
itemDetails.Add(new ItemDetails() { ItemName = "SfComnboBox", ItemID = 03, ItemCode = "AAC"});
itemDetails.Add(new ItemDetails() { ItemName = "SfTreeGrid", ItemID = 04, ItemCode = "AAD" });
}
private ObservableCollection<ItemDetails> itemDetails;
public ObservableCollection<ItemDetails> ItemDetails
{
get
{
return itemDetails;
}
set
{
itemDetails = value;
}
} |
|
<Window.Resources>
<local:ViewModel x:Key="viewModel"/>
</Window.Resources>
<syncfusion:SfDataGrid x:Name="dataGrid" Grid.Column="0"
AutoGenerateColumns="False" AllowEditing="True"
AutoGenerateRelations="False"
AllowResizingColumns="False"
HideEmptyGridViewDefinition="True"
ItemsSource="{Binding Path=OrdersDetails}"
NavigationMode="Cell"
ShowGroupDropArea="True">
<syncfusion:SfDataGrid.DetailsViewDefinition>
<syncfusion:GridViewDefinition RelationalColumn="OrderDetails">
<syncfusion:GridViewDefinition.DataGrid>
<syncfusion:SfDataGrid x:Name="FirstDetailsViewGrid" AllowEditing="True" >
<syncfusion:SfDataGrid.Columns>
<syncfusion:GridComboBoxColumn ItemsSource="{Binding ItemDetails,Source={StaticResource viewModel}}"
MappingName="SelName"
DisplayMemberPath="ItemName"
SelectedValuePath="ItemName" />
</syncfusion:SfDataGrid.Columns>
</syncfusion:SfDataGrid>
</syncfusion:GridViewDefinition.DataGrid>
<syncfusion:GridViewDefinition >
</syncfusion:SfDataGrid.DetailsViewDefinition>
</syncfusion:SfDataGrid> |
Hello,
I was able to use this approach to bind a comboboxcolumn in a nested datagrid. However, I am running into a problem where once the combobox is loaded and the itemsource is modified, the combobox does not reflect the changes made.
Thank You,
Nour
Hi Nour Douffir,
We are a little unclear about your reported issue. Please provide more information related to your query?
Kindly revert to us with the above requested details. It will be more helpful for us to check the possibilities to resolve the reported problem.
Regards,
Vijayarasan S