Hello, i am having problem getting the property of a dynamically created TemplateColumn, with a property of the Itemssources property. Particularly
i have a class like this
public class InsertPersonShowDetails
{
public string Parameter { get; set; }
public string ParameterType { get; set; }
public string ParameterValue { get; set; }
}
and the SfDatagrid ItemsSource is Bound to a ViewModels Observable collection of type InsertPersonShowDetails.
In the datagrid, i am using triggers to create TemplateColumn based on the value of ParameterType property. It creates either a textbox ,or a comboboxn which works fine.
The problem is i can't bind the textbox ,or the combobox inside the TemplateColumn, with the property ParameterValue of my Itemssource.
this is my XAML SfDataGrid
<syncfusion:SfDataGrid x:Name="InsertPersonGeneralDatagrid" AutoGenerateColumns="False" MinHeight="500" MinWidth="500" ColumnSizer="Star" ItemsSource="{Binding Gd,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" SelectedItem="{Binding Floko1}">
<syncfusion:SfDataGrid.Columns>
<syncfusion:GridTextColumn HeaderText="ParameterName" MappingName="Parameter">
</syncfusion:GridTextColumn>
<syncfusion:GridTemplateColumn HeaderText="ParamValue" MappingName="ParameterValue">
<syncfusion:GridTemplateColumn.CellTemplate>
<DataTemplate>
<ContentControl>
<ContentControl.Style>
<Style TargetType="ContentControl">
<Style.Triggers>
<DataTrigger Binding="{Binding ParameterType}" Value="sample1">
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<TextBox >
</TextBox>
</DataTemplate>
</Setter.Value>
</Setter>
</DataTrigger>
<DataTrigger Binding="{Binding ParameterType}" Value="sample2">
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<ComboBox ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type syncfusion:SfDataGrid}}, Path=DataContext.Floko}" DisplayMemberPath="Name"/>
</DataTemplate>
</Setter.Value>
</Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</ContentControl.Style>
</ContentControl>
</DataTemplate>
</syncfusion:GridTemplateColumn.CellTemplate>
</syncfusion:GridTemplateColumn>
</syncfusion:SfDataGrid.Columns>
</syncfusion:SfDataGrid>
Any Help is much appreciated.