Hi Ivailo,
Thank you for contacting Syncfusion support.
We have analyzed your query. You can bind the different ItemsSources to each row of the ComboBox by using GridTemplateColumn in the SfTreeGrid as like below code snippet.
Code Snippet:
<syncfusion:TreeGridTemplateColumn HeaderText="ShipCity" MappingName="CityId" syncfusion:FocusManagerHelper.WantsKeyInput="True">
<syncfusion:TreeGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding CityId}" HorizontalAlignment="Right" />
</DataTemplate>
</syncfusion:TreeGridTemplateColumn.CellTemplate>
<syncfusion:TreeGridTemplateColumn.EditTemplate>
<DataTemplate>
<ComboBox ItemsSource="{Binding CityDescription, Converter={StaticResource converter}}"
SelectedItem="{Binding CityId,Mode=TwoWay}"/>
</DataTemplate>
</syncfusion:TreeGridTemplateColumn.EditTemplate>
</syncfusion:TreeGridTemplateColumn>
|
The ItemsSource for each row of the ComboBox is set based on the CityDescription with the help of converter as below code,
public class ItemsSourceConverter:IValueConverter
{
ShipCityDetailsRepository ShipCity = new ShipCityDetailsRepository();
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
string[] shipcities=null;
//Check whether the CityName contains which is received from value parameter
if (ShipCity.ContainsKey(value.ToString()))
{
//if the key matched , it will return the corresponding shipcities
ShipCity.TryGetValue(value.ToString(), out shipcities);
return shipcities;
}
return null;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
} |
Please let us know if you have any query.
Regards,
Muthukumar K