Hi
Michael,
Thanks
for contacting Syncfusion support.
You
can achieve your requirement by setting CellType as DataBoundTemplate and set
datatemplate as specified in the way.
Please
refer the below code snippet,
Code Snippet:
<syncfusion:GridDataUnboundVisibleColumn> <syncfusion:GridDataUnboundVisibleColumn.ColumnStyle> <syncfusion:GridDataColumnStyle CellType="DataBoundTemplate"> <syncfusion:GridDataColumnStyle.CellItemTemplate> <DataTemplate> <TextBlock Text="{Binding Record.Data.Suppliers.CompanyName}"/> </DataTemplate> </syncfusion:GridDataColumnStyle.CellItemTemplate> </syncfusion:GridDataColumnStyle> </syncfusion:GridDataUnboundVisibleColumn.ColumnStyle> </syncfusion:GridDataUnboundVisibleColumn> |
Please let us know if you have any queries.
Regards,
Jayapradha
<DataTemplate>
<TextBlock Padding="3,5,8,5" DataContext="{Binding Record.Data.TestObjs[Period1]}" Text="{Binding Prop}" FontSize="14">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Style.Triggers>
<DataTrigger Binding="{Binding IsTrue}" Value="True">
<Setter Property="Background" Value="Red"></Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
System.Windows.Data Error: 40 : BindingExpression path error: 'IsTrue' property not found on 'object' ''GridDataCellBoundWrapper' (HashCode=12369902)'. BindingExpression:Path=IsTrue; DataItem='GridDataCellBoundWrapper' (HashCode=12369902); target element is 'TextBlock' (Name=''); target property is 'NoTarget' (type 'Object')
Hi
Michael,
We
analyzed your previous code snippet and you need to bind IsTrue property as
shown in the below code snippet. Since GridDataCellBoundWrapper bind the
property in two ways.
One
is Record.Data and another one is directly binds the CellBoundValue.
<DataTrigger Binding="{Binding Record.Data.
IsTrue}" Value="True"> |
You
need not bind the property for each time, instead, you can set the celltype as
DataBoundTemplate and bind the cellboundvalue. CellBoundValue loads the
value based on the specified MappingName
Please
refer the below code snippet,
Code
snippet:
<syncfusion:GridDataColumnStyle CellType="DataBoundTemplate"> <syncfusion:GridDataColumnStyle.CellItemTemplate> <DataTemplate> <TextBlock Text="{Binding CellBoundValue}" VerticalAlignment="Center"/> </DataTemplate> </syncfusion:GridDataColumnStyle.CellItemTemplate> </syncfusion:GridDataColumnStyle> |
Kindly
let us know if this solution helps you.
Regards,
Jayapradha