2X faster development
The ultimate WPF UI toolkit to boost your development speed.
XAML
C#
Figure: Pivot Grid shows alternate row backgrounds
|
2X faster development
The ultimate WPF UI toolkit to boost your development speed.
This page will automatically be redirected to the sign-in page in 10 seconds.
Hi Branden,
MainWindow is nothing but the current window of your application. And the “rowIdex” and “colIndex” are the static variables are defined in current window to access the cell values in PivotGrid control. Those static variables are re-assigned based on the current cell in TargetUpdated event handler method.
Please refer to the following code example:
#MainWindo.Xaml.cs
public partial class MainWindow : Window
{
public static int rowIdex;
public static int colIndex;
private void Image_TargetUpdated(object sender, DataTransferEventArgs e)
{
var styleInfo = ((sender as Image).TemplatedParent as PivotGridTemplateCell).StyleInfo;
rowIdex = styleInfo.RowIndex;
colIndex = styleInfo.ColumnIndex;
}
}
public class BackColorConverter : IValueConverter
{
Brush brush = Brushes.White;
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
Syncfusion.Windows.Controls.PivotGrid.PivotGridControl pivotGrid = value as Syncfusion.Windows.Controls.PivotGrid.PivotGridControl;
int rowIndex = MainWindow.rowIdex;
int colIndex = MainWindow.colIndex;
if (rowIndex % 2 == 0)
{
brush = Brushes.Pink;
return brush;
}
else
{
if (MainWindow.colIndex == -1 && MainWindow.rowIdex == -1)
{
brush = Brushes.Pink;
}
else
brush = Brushes.Red;
}
return brush;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
Regards,
Sabaridass R.