Hi
I am facing an issue regarding Syncfusion DataGrid. I have used data grid view in 3 pages of my project. The issue is when I am trying to execute the project,it is getting crashed and showing an exception called Null Reference Exception. Here is the exception
System.NullReferenceException: Object reference not set to an instance of an object.\r at Syncfusion.UI.Xaml.Grid.GridHeaderCellControl.OnPointerExited(PointerRoutedEventArgs e)
I have nowhere implemented this method called OnPointerExited. Still it is throwing exception
Here is my Code Snippet-
----XAML Page---
<SFGrid:SfDataGrid x:Name="ListData" BorderThickness="1" Margin="0" Height="270" AutoGenerateColumns="False"
ColumnSizer="SizeToHeader" ScrollViewer.VerticalScrollBarVisibility="Auto" VerticalAlignment="Top" ScrollViewer.HorizontalScrollBarVisibility="Disabled" AllowSorting="False"
BorderBrush="Transparent" AllowGrouping="False" SelectionMode="Single"
HeaderStyle="{StaticResource HeaderCell}"
AllowDeleting="False" NavigationMode="Row" AllowRowHoverHighlighting="True"
Padding="5" Visibility="Visible" Background="White"
SelectionChanged="ListData_SelectionChanged">
<SFGrid:SfDataGrid.Columns>
<SFGrid:GridTextColumn HeaderText="CATEGORY" MappingName="name" Width="450" TextAlignment="Left" HorizontalHeaderContentAlignment="Left"/>
<SFGrid:GridTextColumn HeaderText="SUB-CATEGORIES" MappingName="categories" Width="175" TextAlignment="Center"/>
<SFGrid:GridTextColumn HeaderText="THREADS" MappingName="threadCount" Width="150" TextAlignment="Center" HorizontalHeaderContentAlignment="Center"/>
<SFGrid:GridTextColumn HeaderText="POSTS" MappingName="messageCount" Width="100" TextAlignment="Center" HorizontalHeaderContentAlignment="Center"/>
<SFGrid:GridTemplateColumn HeaderText="ACTIONS" Width="150" HorizontalHeaderContentAlignment="Center" TextAlignment="Center" >
<SFGrid:GridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Width="50" Background="Black" VerticalAlignment="Center" HorizontalAlignment="Center">
<ComboBox x:Name="CategoryAction" Foreground="White" Width="20" SelectionChanged="CategoryAction_SelectionChanged" DataContext="{Binding categoryId}">
<ComboBox.Background >
<ImageBrush ImageSource="/Assets/nav.png" />
</ComboBox.Background>
<ComboBoxItem Background="#4d4d4d" Tag="Edit">
<StackPanel Orientation="Horizontal">
<Image Source="/Assets/edit_2.png" Width="15"></Image>
<TextBlock Foreground="White" Margin="6,0,0,0">Edit</TextBlock>
</StackPanel>
</ComboBoxItem>
<ComboBoxItem Background="#4d4d4d" Tag="Delete">
<StackPanel Orientation="Horizontal">
<Image Source="/Assets/delete.png" Width="15"></Image>
<TextBlock Foreground="White" Margin="6,0,0,0">Delete</TextBlock>
</StackPanel>
</ComboBoxItem>
</ComboBox>
</StackPanel>
</DataTemplate>
</SFGrid:GridTemplateColumn.CellTemplate>
</SFGrid:GridTemplateColumn>
</SFGrid:SfDataGrid.Columns>
</SFGrid:SfDataGrid>
----CS Page---
// Assigning ItemSource to the data grid
mbctrgy = await MessageManager.GetAllCategories();
if (mbctrgy.Count != 0)
{
ListData.ItemsSource = mbctrgy;
}
// getting which row is to be selected
private void ListData_SelectionChanged(object sender, Syncfusion.UI.Xaml.Grid.GridSelectionChangedEventArgs e)
{
try
{
if (ListData.SelectedItem != null)
{
category_id = ((LN2Entities.Model.Forum.MBCategory)(ListData.SelectedItem)).categoryId;
if (category_id != 0)
{
string category_name = ((LN2Entities.Model.Forum.MBCategory)(ListData.SelectedItem)).name;
viewSubCategoryList(category_id, category_name);
}
}
}
catch { }
}
Except this there is no method related to datagridview was implemented anywhere. Please help me regarding this issue.Waiting for you reply.
Thanks in advance.