- Home
- Forum
- Xamarin.Forms
- Null reference exception When try to Bind SelectedItems
Null reference exception When try to Bind SelectedItems
Hello, I am trying to Bind SfDataGrid.SelectedItems and get a crash:
at Syncfusion.SfDataGrid.XForms.SfDataGrid.WireEvents () [0x0000f] in <a74d4daa2e9d4fbb83f3e9693ce0c478>:0
at Syncfusion.SfDataGrid.XForms.SfDataGrid.SetSourceList (System.Object source) [0x0000d] in <a74d4daa2e9d4fbb83f3e9693ce0c478>:0
at Syncfusion.SfDataGrid.XForms.SfDataGrid.RefreshContainerAndView () [0x0002c] in <a74d4daa2e9d4fbb83f3e9693ce0c478>:0
at Syncfusion.SfDataGrid.XForms.SfDataGrid.gridLoaded () [0x00032] in <a74d4daa2e9d4fbb83f3e9693ce0c478>:0
at Syncfusion.SfDataGrid.XForms.SfDataGrid.LayoutChildren (System.Double x, System.Double y, System.Double width, System.Double height) [0x00068] in <a74d4daa2e9d4fbb83f3e9693ce0c478>:0
at Xamarin.Forms.Layout.UpdateChildrenLayout () [0x00158] in d:\a\1\s\Xamarin.Forms.Core\Layout.cs:266
at Xamarin.Forms.Layout.OnSizeAllocated (System.Double width, System.Double height) [0x0000f] in d:\a\1\s\Xamarin.Forms.Core\Layout.cs:224
at Syncfusion.SfDataGrid.XForms.SfDataGrid.OnSizeAllocated (System.Double width, System.Double height) [0x0001f] in <a74d4daa2e9d4fbb83f3e9693ce0c478>:0
at Xamarin.Forms.VisualElement.SizeAllocated (System.Double width, System.Double height) [0x00000] in d:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:792
at Xamarin.Forms.VisualElement.SetSize (System.Double width, System.Double height) [0x00021] in d:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:1062
at Xamarin.Forms.VisualElement.set_Bounds (Xamarin.Forms.Rectangle value) [0x0005d] in d:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:307
at Xamarin.Forms.VisualElement.Layout (Xamarin.Forms.Rectangle bounds) [0x00000] in d:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:688
at Xamarin.Forms.Layout.LayoutChildIntoBoundingRegion (Xamarin.Forms.VisualElement child, Xamarin.Forms.Rectangle region) [0x001da] in d:\a\1\s\Xamarin.Forms.Core\Layout.cs:178
at Xamarin.Forms.Grid.LayoutChildren (System.Double x, System.Double y, System.Double width, System.Double height) [0x00144] in d:\a\1\s\Xamarin.Forms.Core\GridCalc.cs:49
at Xamarin.Forms.Layout.UpdateChildrenLayout () [0x00158] in d:\a\1\s\Xamarin.Forms.Core\Layout.cs:266
at Xamarin.Forms.Layout.OnSizeAllocated (System.Double width, System.Double height) [0x0000f] in d:\a\1\s\Xamarin.Forms.Core\Layout.cs:224
at Xamarin.Forms.VisualElement.SizeAllocated (System.Double width, System.Double height) [0x00000] in d:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:792
at Xamarin.Forms.Layout.ResolveLayoutChanges () [0x0005c] in d:\a\1\s\Xamarin.Forms.Core\Layout.cs:392
at Foundation.NSAsyncActionDispatcher.Apply () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.10.0.21/src/Xamarin.iOS/Foundation/NSAction.cs:152
at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.10.0.21/src/Xamarin.iOS/UIKit/UIApplication.cs:86
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.10.0.21/src/Xamarin.iOS/UIKit/UIApplication.cs:65
at Qkiss.iOS.Application.Main (System.String[] args) [0x00001] in /Users/evgeniykhoduley/q-kiss/src/platform/Qkiss.iOS/Main.cs:11
I have the following code:
I have the following code:
<sfDataGrid:SfDataGrid
Grid.Row="7"
Grid.Column="0"
Grid.RowSpan="6"
Grid.ColumnSpan="5"
x:Name="TaskGrid"
ItemsSource="{Binding TaskTemplates.DisplayItems}"
AutoGenerateColumns="False"
IsVisible="{Binding IsNewTaskType, Converter={StaticResource InvertBoolConverter}}"
SelectionMode="Multiple"
ColumnSizer="LastColumnFill"
GridStyle="{StaticResource QkissTaskGridStyle}"
AllowResizingColumn="True"
EnableDataVirtualization="True"
QueryRowHeight="TaskSupplyDataGrid_OnQueryRowHeight"
BackgroundColor="Transparent"
AllowSorting="True"
SelectionController="{StaticResource QkissDataGridController}"
SelectedItem="{Binding SelectedTaskTemplate}"
SelectedItems="{Binding SelectedTaskTemplates, Mode=OneWay}">
public class QkissDataGridController : GridSelectionController {
private readonly ColorResource _colorResource;
public QkissDataGridController() {
_colorResource = new ColorResource();
}
public override Color GetSelectionColor(int rowIndex, object rowData)
{
return Xamarin.Forms.Color.FromHex("#93e687");
}
}
SIGN IN To post a reply.
2 Replies
KK
Karthikraja Kalaimani
Syncfusion Team
June 1, 2020 01:06 PM UTC
Hi Evgeni,
Currently, we are validating the reported issue and we will validate and update you further details on or before 3rd June 2020. We appreciate your patience until then.
Regards,
Karthik Raja
Currently, we are validating the reported issue and we will validate and update you further details on or before 3rd June 2020. We appreciate your patience until then.
Regards,
Karthik Raja
KK
Karthikraja Kalaimani
Syncfusion Team
June 3, 2020 02:57 PM UTC
Hi Evgeni,
Please let us know the below details to check the issue and provide you a better solution asap.
i) SfDataGrid version
ii) Xamarin forms version
Regards,
Karthik Raja
Please let us know the below details to check the issue and provide you a better solution asap.
i) SfDataGrid version
ii) Xamarin forms version
Regards,
Karthik Raja
SIGN IN To post a reply.
- 2 Replies
- 2 Participants
-
EV Evgeni
- May 29, 2020 08:05 AM UTC
- Jun 3, 2020 02:57 PM UTC