BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
Hi,
The cell style setting doesn't work with the new update.
I have to change the color of the entire line according to a variable using a Converter.
I checked an example with an older version and it works.
In the attached example when you try to access the Notify view via Drawer it will go into an exception.
Removing the CellStyle property from the Datagrid will not throw an exception.
Can you advise me how to solve this problem...?
Thank you
Hi,
I'm also following this example which uses RowStyle and VirtualizingCellsControl with no success.
This is my code,
why don't function correctly?
<Page x:Class="TesmitWpfApp.Views.NotifyView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
DataContext="{Binding RelativeSource={RelativeSource Self}}"
mc:Ignorable="d"
d:DesignHeight="525" d:DesignWidth="984"
Title="NotifyView">
<Page.Resources>
<Style x:Key="headerStyle" TargetType="syncfusion:GridHeaderCellControl">
<Setter Property="FontWeight" Value="DemiBold"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="Background" Value="RoyalBlue"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="BorderBrush" Value="White"/>
</Style>
<Style x:Key="cellStyle" TargetType="syncfusion:GridCell">
<Setter Property="FontSize" Value="16"/>
<Setter Property="FontWeight" Value="DemiBold"/>
<Setter Property="FontFamily" Value="Century Gothic"/>
<Setter Property="Foreground" Value="RoyalBlue"/>
<Setter Property="BorderBrush" Value="Firebrick"/>
</Style>
</Page.Resources>
<Grid>
<syncfusion:SfDataGrid x:Name="DataGridView"
AutoGenerateColumns="False"
Margin="4"
HeaderRowHeight="40"
RowHeight="40"
ItemsSource="{Binding Messages}"
HeaderStyle="{StaticResource headerStyle}"
CellStyle="{StaticResource cellStyle}">
<syncfusion:SfDataGrid.Columns>
<syncfusion:GridTextColumn MappingName="Id"
HeaderText="ID"
ColumnSizer="Auto">
</syncfusion:GridTextColumn>
<syncfusion:GridTextColumn MappingName="Group"
HeaderText="Gruppo"
ColumnSizer="Auto"/>
<syncfusion:GridTextColumn MappingName="Description"
HeaderText="Descrizione"
ColumnSizer="Star"
HorizontalHeaderContentAlignment="Left"/>
</syncfusion:SfDataGrid.Columns>
<syncfusion:SfDataGrid.RowStyle>
<Style TargetType="DataGridRow">
<Style.Triggers>
<DataTrigger Binding="{Binding Group}" Value="A">
<Setter Property="Background" Value="Red"></Setter>
<Setter Property="Foreground" Value="White"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding Group}" Value="W">
<Setter Property="Background" Value="Yellow"></Setter>
<Setter Property="Foreground" Value="Black"></Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</syncfusion:SfDataGrid.RowStyle>
</syncfusion:SfDataGrid>
</Grid>
</Page>
Edoardo Gazzola,
We have checked the reported 'CellStyle and RowStyle problem' and were able to replicate the issue with the provided sample. We then attempted to change the xmlns namespace for the datagrid, and it is now working properly. Please refer to the code snippets below.
<Page x:Class="TesmitWpfApp.Views.NotifyView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:syncfusion="http://schemas.syncfusion.com/wpf" xmlns:local="clr-namespace:TesmitWpfApp.Views" DataContext="{Binding RelativeSource={RelativeSource Self}}" xmlns:grid="clr-namespace:Syncfusion.UI.Xaml.Grid;assembly=Syncfusion.SfGrid.WPF" mc:Ignorable="d" d:DesignHeight="525" d:DesignWidth="984" Title="NotifView">
<Page.Resources> <Style x:Key="headerStyle" TargetType="grid:GridHeaderCellControl"> <Setter Property="FontWeight" Value="DemiBold"/> <Setter Property="FontSize" Value="16"/> <Setter Property="Background" Value="RoyalBlue"/> <Setter Property="Foreground" Value="#FFCEE2F6"/> <Setter Property="BorderBrush" Value="White"/> <Setter Property="BorderThickness" Value="1"/> </Style> <Style x:Key="cellStyle" TargetType="grid:GridCell"> <Setter Property="FontSize" Value="16"/> <Setter Property="FontWeight" Value="DemiBold"/> <Setter Property="FontFamily" Value="Century Gothic"/> <Setter Property="Foreground" Value="RoyalBlue"/> <Setter Property="BorderBrush" Value="Firebrick"/> </Style> </Page.Resources>
<Grid> <syncfusion:SfDataGrid x:Name="DataGridView" AutoGenerateColumns="False" Margin="4" HeaderRowHeight="40" RowHeight="40" ItemsSource="{Binding Messages}" CellStyle="{StaticResource cellStyle}" HeaderStyle="{StaticResource headerStyle}"> <syncfusion:SfDataGrid.Columns> <syncfusion:GridTextColumn MappingName="Id" HeaderText="ID"
ColumnSizer="Auto"> </syncfusion:GridTextColumn> <syncfusion:GridTextColumn MappingName="Group" HeaderText="Gruppo" ColumnSizer="Auto"/> <syncfusion:GridTextColumn MappingName="Description" HeaderText="Descrizione" ColumnSizer="Star" HorizontalHeaderContentAlignment="Left"/> </syncfusion:SfDataGrid.Columns> <syncfusion:SfDataGrid.RowStyle> <Style TargetType="grid:VirtualizingCellsControl"> <Style.Triggers> <DataTrigger Binding="{Binding Group}" Value="A"> <Setter Property="Background" Value="Red"></Setter> <Setter Property="Foreground" Value="White"></Setter> </DataTrigger> <DataTrigger Binding="{Binding Group}" Value="B"> <Setter Property="Background" Value="Yellow"></Setter> <Setter Property="Foreground" Value="Black"></Setter> </DataTrigger> </Style.Triggers> </Style> </syncfusion:SfDataGrid.RowStyle> </syncfusion:SfDataGrid> </Grid> </Page>
|
Note: Cell style has higher priority than row style. Only the foreground of Group A and B should not be changed. Because, we have defined the foreground for cell style as RoyalBlue. If you remove the foreground from the cell style, then the row style foreground will be applied.
Hi Sathiyathanam Jeyakumar,
Perfect...thanks for your tecnichal support.
Regards
Edoardo Gazzola,
We are glad to know that the reported problem has been resolved at your end. If you are satisfied with our response, please mark it as an answer. Otherwise, please let us know if you have any further queries on this. We are happy to help you.