Telerik Forums
UI for .NET MAUI Forum
1 answer
79 views

Hi all...

 

We are using a RadCollectionView with grouping (Level 1 and 2),

We came up with a need to drag and drop (reorder) a whole collection of items (group) by dragging and dropping only the group header.

Is this achievable?

 

And if not - can this functionality be added?

Thanks in advance, Itzik :)

Didi
Telerik team
 answered on 20 Jan 2025
1 answer
274 views
When im trying to load information to a list view in my page sometimes this crashes and this is the error that i gave, trying with the native listview the error doesn't happen

Error:

{ObjCRuntime.ObjCException: Objective-C exception thrown.  Name: NSInternalInconsistencyException Reason: Invalid batch updates detected: the number of sections and/or items returned by the data source before and after performing the batch updates are inconsistent with the updates.

Data source before updates = { 3 sections with item counts: [30, 6, 2] }

Data source after updates = { 3 sections with item counts: [30, 6, 2] }

Updates = [

Insert item (0 - 15),

Insert item (0 - 16),

Insert item (0 - 17),

Insert item (0 - 18),

Insert item (0 - 19),

Insert item (0 - 20),

Insert item (0 - 21),

Insert item (0 - 22),

Insert item (0 - 23),

Insert item (0 - 24),

Insert item (0 - 25),

Insert item (0 - 26),

Insert item (0 - 27),

Insert item (0 - 28),

Insert item (0 - 29),

Insert item (1 - 3),

Insert item (1 - 4),

Insert item (1 - 5),

Insert item (2 - 1)

]

Collection view: <TKCollectionView: 0x1237b3200; baseClass = UICollectionView; frame = (0 0; 350 400); clipsToBounds = YES; autoresize = W+H; gestureRecognizers = <NSArray: 0x600000d933c0>; backgroundColor = UIExtendedGrayColorSpace 0 0; layer = <CALayer: 0x60000435c160>; contentOffset: {0, 0}; contentSize: {350, 1365.6666666666667}; adjustedContentInset: {0, 0, 0, 0}; layout: <TKListViewLinearLayout: 0x1329186b0>; dataSource: <Telerik_Maui_Controls_Compatibility_DataControlsRenderer_iOS_TKExtendedListView: 0x123e59480; frame = (0 0; 350 400); hidden = YES; backgroundColor = UIExtendedSRGBColorSpace 1 1 1 1; layer = <CALayer: 0x60000435c420>>>

Native stack trace:

0   CoreFoundation                      0x00000001804b70ec __exceptionPreprocess + 172

1   libobjc.A.dylib                     0x000000018008ede8 objc_exception_throw + 72

2   Foundation                          0x0000000180e73aa8 _userInfoForFileAndLine + 0

3   UIKitCore                           0x00000001851c27a8 -[UICollectionView _Bug_Detected_In_Client_Of_UICollectionView_Invalid_Batch_Updates:] + 92

4   UIKitCore                           0x00000001851c2118 -[UICollectionView _endItemAnimationsWithInvalidationContext:tentativelyForReordering:animator:collectionViewAnimator:] + 10296

5   UIKitCore                           0x00000001851beb18 -[UICollectionView _updateRowsAtIndexPaths:updateAction:updates:] + 448

6   UIKitCore                           0x00000001851bec74 -[UICollectionView insertItemsAtIndexPaths:] + 52

7   InbrosApp                           0x000000010432733c -[TKCollectionView insertItemsAtIndexPaths:] + 124

8   InbrosApp                           0x0000000104318dcc __38-[TKListView insertItemsAtIndexPaths:]_block_invoke + 68

9   UIKitCore                           0x0000000186012478 +[UIView(UIViewAnimationWithBlocks) _setupAnimationWithDuration:delay:view:options:factory:animations:start:animationStateGenerator:completion:] + 496

10  UIKitCore                           0x0000000186012a70 +[UIView(UIViewAnimationWithBlocks) animateWithDuration:animations:] + 48

11  InbrosApp                           0x0000000104318d14 -[TKListView insertItemsAtIndexPaths:] + 308

12  libxamarin-dotnet-debug.dylib       0x00000001053f4c9c xamarin_dyn_objc_msgSendSuper + 164

13  libmonosgen-2.0.dylib               0x0000000105bf4abc do_icall + 200

14  libmonosgen-2.0.dylib               0x0000000105bf33d0 do_icall_wrapper + 356

15  libmonosgen-2.0.dylib               0x0000000105be7e20 mono_interp_exec_method + 2836

16  libmonosgen-2.0.dylib               0x0000000105be5088 interp_entry_from_trampoline + 548

17  InbrosApp                           0x0000000104345a18 native_to_interp_trampoline + 104

18  libdispatch.dylib                   0x0000000180178de0 _dispatch_client_callout + 16

19  libdispatch.dylib                   0x0000000180187c60 _dispatch_main_queue_drain + 1272

20  libdispatch.dylib                   0x0000000180187758 _dispatch_main_queue_callback_4CF + 40

21  CoreFoundation                      0x000000018041ae3c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12

22  CoreFoundation                      0x0000000180415534 __CFRunLoopRun + 1944

23  CoreFoundation                      0x0000000180414960 CFRunLoopRunSpecific + 536

24  GraphicsServices                    0x0000000190183b10 GSEventRunModal + 160

25  UIKitCore                           0x0000000185aa2b40 -[UIApplication _run] + 796

26  UIKitCore                           0x0000000185aa6d38 UIApplicationMain + 124

27  libxamarin-dotnet-debug.dylib       0x00000001053aff00 xamarin_UIApplicationMain + 60

28  libmonosgen-2.0.dylib               0x0000000105bf4b30 do_icall + 316

29  libmonosgen-2.0.dylib               0x0000000105bf33d0 do_icall_wrapper + 356

30  libmonosgen-2.0.dylib               0x0000000105be7e20 mono_interp_exec_method + 2836

31  libmonosgen-2.0.dylib               0x0000000105be59c0 interp_runtime_invoke + 244

32  libmonosgen-2.0.dylib               0x0000000105afec64 mono_jit_runtime_invoke + 1116

33  libmonosgen-2.0.dylib               0x0000000105cb9d10 mono_runtime_invoke_checked + 148

34  libmonosgen-2.0.dylib               0x0000000105cc12f0 mono_runtime_exec_main_checked + 116

35  libmonosgen-2.0.dylib               0x0000000105b52eec mono_jit_exec + 364

36  libxamarin-dotnet-debug.dylib       0x00000001053f3b00 xamarin_main + 2320

37  InbrosApp                           0x000000010435d0c0 main + 72

38  dyld                                0x0000000104771410 start_sim + 20

39  ???                                 0x00000001044b2274 0x0 + 4367000180

 

   at TelerikUI.TKListView.InsertItems(NSIndexPath[] indexPaths)

   at Telerik.Maui.Controls.Compatibility.DataControlsRenderer.iOS.ListViewBatchUpdates.ApplyChanges()

   at Telerik.Maui.Controls.Compatibility.DataControlsRenderer.iOS.TKExtendedListView.<ScheduleBatchUpdates>b__44_0()

   at Microsoft.Maui.Dispatching.Dispatcher.<>c__DisplayClass10_0.<DispatchDelayedImplementation>b__0()

   at CoreFoundation.DispatchQueue.static_dispatcher_to_managed(IntPtr context) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/CoreFoundation/Dispatch.cs:line 379

   at UIKit.UIApplication.UIApplicationMain(Int32 , String[] , IntPtr , IntPtr ) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:line 58

   at UIKit.UIApplication.Main(String[] , Type , Type ) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:line 94

   at InbrosApp.Program.Main(String[] args) in /Users/carminamoreno/Documents/GitHub/Inbros/InbrosApp/Platforms/iOS/Program.cs:line 13

Native stack trace:

0   CoreFoundation                      0x00000001804b70ec __exceptionPreprocess + 172

1   libobjc.A.dylib                     0x000000018008ede8 objc_exception_throw + 72

2   Foundation                          0x0000000180e73aa8 _userInfoForFileAndLine + 0

3   UIKitCore                           0x00000001851c27a8 -[UICollectionView _Bug_Detected_In_Client_Of_UICollectionView_Invalid_Batch_Updates:] + 92

4   UIKitCore                           0x00000001851c2118 -[UICollectionView _endItemAnimationsWithInvalidationContext:tentativelyForReordering:animator:collectionViewAnimator:] + 10296

5   UIKitCore                           0x00000001851beb18 -[UICollectionView _updateRowsAtIndexPaths:updateAction:updates:] + 448

6   UIKitCore                           0x00000001851bec74 -[UICollectionView insertItemsAtIndexPaths:] + 52

7   InbrosApp                           0x000000010432733c -[TKCollectionView insertItemsAtIndexPaths:] + 124

8   InbrosApp                           0x0000000104318dcc __38-[TKListView insertItemsAtIndexPaths:]_block_invoke + 68

9   UIKitCore                           0x0000000186012478 +[UIView(UIViewAnimationWithBlocks) _setupAnimationWithDuration:delay:view:options:factory:animations:start:animationStateGenerator:completion:] + 496

10  UIKitCore                           0x0000000186012a70 +[UIView(UIViewAnimationWithBlocks) animateWithDuration:animations:] + 48

11  InbrosApp                           0x0000000104318d14 -[TKListView insertItemsAtIndexPaths:] + 308

12  libxamarin-dotnet-debug.dylib       0x00000001053f4c9c xamarin_dyn_objc_msgSendSuper + 164

13  libmonosgen-2.0.dylib               0x0000000105bf4abc do_icall + 200

14  libmonosgen-2.0.dylib               0x0000000105bf33d0 do_icall_wrapper + 356

15  libmonosgen-2.0.dylib               0x0000000105be7e20 mono_interp_exec_method + 2836

16  libmonosgen-2.0.dylib               0x0000000105be5088 interp_entry_from_trampoline + 548

17  InbrosApp                           0x0000000104345a18 native_to_interp_trampoline + 104

18  libdispatch.dylib                   0x0000000180178de0 _dispatch_client_callout + 16

19  libdispatch.dylib                   0x0000000180187c60 _dispatch_main_queue_drain + 1272

20  libdispatch.dylib                   0x0000000180187758 _dispatch_main_queue_callback_4CF + 40

21  CoreFoundation                      0x000000018041ae3c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12

22  CoreFoundation                      0x0000000180415534 __CFRunLoopRun + 1944

23  CoreFoundation                      0x0000000180414960 CFRunLoopRunSpecific + 536

24  GraphicsServices                    0x0000000190183b10 GSEventRunModal + 160

25  UIKitCore                           0x0000000185aa2b40 -[UIApplication _run] + 796

26  UIKitCore                           0x0000000185aa6d38 UIApplicationMain + 124

27  libxamarin-dotnet-debug.dylib       0x00000001053aff00 xamarin_UIApplicationMain + 60

28  libmonosgen-2.0.dylib               0x0000000105bf4b30 do_icall + 316

29  libmonosgen-2.0.dylib               0x0000000105bf33d0 do_icall_wrapper + 356

30  libmonosgen-2.0.dylib               0x0000000105be7e20 mono_interp_exec_method + 2836

31  libmonosgen-2.0.dylib               0x0000000105be59c0 interp_runtime_invoke + 244

32  libmonosgen-2.0.dylib               0x0000000105afec64 mono_jit_runtime_invoke + 1116

33  libmonosgen-2.0.dylib               0x0000000105cb9d10 mono_runtime_invoke_checked + 148

34  libmonosgen-2.0.dylib               0x0000000105cc12f0 mono_runtime_exec_main_checked + 116

35  libmonosgen-2.0.dylib               0x0000000105b52eec mono_jit_exec + 364

36  libxamarin-dotnet-debug.dylib       0x00000001053f3b00 xamarin_main + 2320

37  InbrosApp                           0x000000010435d0c0 main + 72

38  dyld                                0x0000000104771410 start_sim + 20

39  ???                                 0x00000001044b2274 0x0 + 4367000180

}




Didi
Telerik team
 answered on 26 Nov 2024
1 answer
214 views

I have a RadListView I am setting up to replace the standard Maui ListView.

One thing I need to do is set the Selected item in the ViewModel as part of a filter so filtered item is already selected.  This seems to be an issue with doing this in the RadListView.


<telerik:RadListView x:Name="RadListView" 
                     BackgroundColor="Transparent" VerticalOptions="Fill"
                     ItemsSource="{Binding SymbolItems}"
                     SelectionMode="Single" SelectionGesture="Tap" IsGroupHeaderSticky="True"
                     SelectedItem="{Binding SelectedSymbolItem, Mode=TwoWay}" >

I setup the SelectedItem to fire off the Notify (this uses Prism base class)

public SymbolItem SelectedSymbolItem
{
	get => _selectedSymbolItem;
	set => SetProperty(ref _selectedSymbolItem, value);
}

But when I set the SelectedItem I get an exception

Value cannot be null. (Parameter 'indexPath')
   at ObjCRuntime.ThrowHelper.ThrowArgumentNullException(String argumentName) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/ThrowHelper.cs:line 28
   at ObjCRuntime.NativeObjectExtensions.GetNonNullHandle(INativeObject self, String argumentName) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/INativeObject.cs:line 42
   at TelerikUI.TKListView.SelectItem(NSIndexPath indexPath, Boolean animated, UICollectionViewScrollPosition scrollPosition)
   at Telerik.Maui.Controls.Compatibility.DataControlsRenderer.iOS.ListViewRenderer.SelectItem(Object item)
   at Telerik.Maui.Controls.Compatibility.DataControls.RadListView.OnSelectedItemAdded(Object item)
   at Telerik.Maui.Controls.Compatibility.DataControls.RadListView.OnSelectedItemsCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
   at System.Collections.ObjectModel.ObservableCollection`1[[System.Object, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at Telerik.Maui.Controls.Compatibility.DataControls.ListView.SelectedItemsCollection.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at System.Collections.ObjectModel.ObservableCollection`1[[System.Object, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].OnCollectionChanged(NotifyCollectionChangedAction action, Object item, Int32 index)
   at System.Collections.ObjectModel.ObservableCollection`1[[System.Object, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].InsertItem(Int32 index, Object item)
   at Telerik.Maui.Controls.Compatibility.DataControls.ListView.SelectedItemsCollection.InsertItem(Int32 index, Object item)
   at System.Collections.ObjectModel.Collection`1[[System.Object, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Add(Object item)
   at Telerik.Maui.Controls.Compatibility.DataControls.RadListView.UpdateSelectedItem()
   at Telerik.Maui.Controls.Compatibility.DataControls.RadListView.OnPropertyChanged(String propertyName)

The value being set is definitely not null.

Also I notice that the Setter seems to be getting invoked twice, so if I put a breakpoint my code goes in and executes the setter, and then seems like the framework does something and invokes it again which throws the exception.

Can SelectedItem in a RadListView be set be using the bound property? (like with any general TwoWay binding).  If not how could this be achieved?

Didi
Telerik team
 answered on 11 Nov 2024
1 answer
363 views

Hi,

I've updated to the latest workload and MAUI versions to target iOS 18.

When an item is added to a RadListView I get an application crash which is not recoverable. Please note that I've upgraded Telerik.UI.for.Maui from 7.0.0 to 7.1.0.

 

Below is the error

Objective-C exception thrown.  Name: NSInternalInconsistencyException Reason: Expected dequeued view to be returned to the collection view in preparation for display. When the collection view's data source is asked to provide a view for a given index path, ensure that a single view is dequeued and returned to the collection view. Avoid dequeuing views without a request from the collection view. For retrieving an existing view in the collection view, use -[UICollectionView cellForItemAtIndexPath:] or -[UICollectionView supplementaryViewForElementKind:atIndexPath:]. Dequeued view: <Telerik_Maui_Controls_Compatibility_DataControlsRenderer_iOS_ListView_UIListViewGroupHeaderCell: 0x1312df000; baseClass = UICollectionViewCell; frame = (0 0; 0 0); alpha = 0; gestureRecognizers = <NSArray: 0x30f0281d0>; backgroundColor = UIExtendedSRGBColorSpace 1 1 1 1; layer = <CALayer: 0x3078ad060>>; Collection view: <TKCollectionView: 0x11f39aa00; baseClass = UICollectionView; frame = (0 0; 0 0); clipsToBounds = YES; autoresize = W+H; gestureRecognizers = <NSArray: 0x303dab1b0>; backgroundColor = UIExtendedGrayColorSpace 0 0; layer = <CALayer: 0x3077297a0>; contentOffset: {0, 0}; contentSize: {0, 217.5}; adjustedContentInset: {0, 0, 0, 0}; layout: <TKListViewLinearLayout: 0x132300280>; dataSource: <Telerik_Maui_Controls_Compatibility_DataControlsRenderer_iOS_TKExtendedListView: 0x13201a100; frame = (0 0; 0 0); backgroundColor = UIExtendedGrayColorSpace 0 0; layer = <CALayer: 0x307729440>>>
Native stack trace:
0   CoreFoundation                      0x000000018c3887d8 1532D3D8-9B3B-3F2F-B35F-55A20DDF411B + 534488
1   libobjc.A.dylib                     0x000000018965b2e4 objc_exception_throw + 88
2   Foundation                          0x000000018b7588d8 6D0212CC-3B9E-32C9-BE20-72989CE3ACB8 + 8452312
3   UIKitCore                           0x000000018f4e4d5c 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 10456412
4   UIKitCore                           0x000000018fc244c4 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 18056388
5   UIKitCore                           0x000000018ec99254 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 1757780
6   UIKitCore                           0x000000018edf17c4 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 3168196
7   AOS.RA.Mobile                       0x000000010416bce4 -[TKCollectionView layoutSubviews] + 56
8   UIKitCore                           0x000000018eaf9688 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 54920
9   QuartzCore                          0x000000018de2fc28 D8E8E86D-85AC-3C90-B2E1-940235ECAA18 + 494632
10  QuartzCore                          0x000000018de2f7b4 D8E8E86D-85AC-3C90-B2E1-940235ECAA18 + 493492
11  QuartzCore                          0x000000018de86914 D8E8E86D-85AC-3C90-B2E1-940235ECAA18 + 850196
12  QuartzCore                          0x000000018de057c4 D8E8E86D-85AC-3C90-B2E1-940235ECAA18 + 321476
13  QuartzCore                          0x000000018de48a0c D8E8E86D-85AC-3C90-B2E1-940235ECAA18 + 596492
14  UIKitCore                           0x000000018eb8f568 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 669032
15  UIKitCore                           0x000000018eb8cb64 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 658276
16  UIKitCore                           0x000000018eb8c9d8 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 657880
17  UIKitCore                           0x000000018eb8c628 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 656936
18  UIKitCore                           0x000000018eb8d59c 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 660892
19  CoreFoundation                      0x000000018c35c328 1532D3D8-9B3B-3F2F-B35F-55A20DDF411B + 353064
20  CoreFoundation                      0x000000018c35c2bc 1532D3D8-9B3B-3F2F-B35F-55A20DDF411B + 352956
21  CoreFoundation                      0x000000018c359e24 1532D3D8-9B3B-3F2F-B35F-55A20DDF411B + 343588
22  CoreFoundation                      0x000000018c358fbc 1532D3D8-9B3B-3F2F-B35F-55A20DDF411B + 339900
23  CoreFoundation                      0x000000018c358830 CFRunLoopRunSpecific + 588
24  GraphicsServices                    0x00000001d83381c4 GSEventRunModal + 164
25  UIKitCore                           0x000000018eebeeb0 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 4009648
26  UIKitCore                           0x000000018ef6d5b4 UIApplicationMain + 340
27  AOS.RA.Mobile                       0x00000001047e4da4 xamarin_UIApplicationMain + 60
28  AOS.RA.Mobile                       0x0000000104b3dbb4 do_icall + 316
29  AOS.RA.Mobile                       0x0000000104b3c4b4 do_icall_wrapper + 348
30  AOS.RA.Mobile                       0x0000000104b30ec4 mono_interp_exec_method + 2836
31  AOS.RA.Mobile                       0x0000000104b2ea5c interp_runtime_invoke + 236
32  AOS.RA.Mobile                       0x0000000104afd634 mono_jit_runtime_invoke + 1116
33  AOS.RA.Mobile                       0x0000000104aa4cf8 mono_runtime_invoke_checked + 148
34  AOS.RA.Mobile                       0x0000000104aaaff4 mono_runtime_exec_main_checked + 116
35  AOS.RA.Mobile                       0x0000000104b02c50 mono_jit_exec + 356
36  AOS.RA.Mobile                       0x0000000104810038 xamarin_main + 2324
37  AOS.RA.Mobile                       0x0000000104b6b484 main + 64
38  dyld                                0x00000001b1d46ec8 3060D36A-16CE-3C3A-9258-3881459F5714 + 212680

 

 

The message of the exception:
Expected dequeued view to be returned to the collection view in preparation for display. When the collection view's data source is asked to provide a view for a given index path, ensure that a single view is dequeued and returned to the collection view. Avoid dequeuing views without a request from the collection view. For retrieving an existing view in the collection view, use -[UICollectionView cellForItemAtIndexPath:] or -[UICollectionView supplementaryViewForElementKind:atIndexPath:]. Dequeued view: <Telerik_Maui_Controls_Compatibility_DataControlsRenderer_iOS_ListView_UIListViewGroupHeaderCell: 0x1312df000; baseClass = UICollectionViewCell; frame = (0 0; 0 0); alpha = 0; gestureRecognizers = <NSArray: 0x30f0281d0>; backgroundColor = UIExtendedSRGBColorSpace 1 1 1 1; layer = <CALayer: 0x3078ad060>>; Collection view: <TKCollectionView: 0x11f39aa00; baseClass = UICollectionView; frame = (0 0; 0 0); clipsToBounds = YES; autoresize = W+H; gestureRecognizers = <NSArray: 0x303dab1b0>; backgroundColor = UIExtendedGrayColorSpace 0 0; layer = <CALayer: 0x3077297a0>; contentOffset: {0, 0}; contentSize: {0, 217.5}; adjustedContentInset: {0, 0, 0, 0}; layout: <TKListViewLinearLayout: 0x132300280>; dataSource: <Telerik_Maui_Controls_Compatibility_DataControlsRenderer_iOS_TKExtendedListView: 0x13201a100; frame = (0 0; 0 0); backgroundColor = UIExtendedGrayColorSpace 0 0; layer = <CALayer: 0x307729440>>>

Didi
Telerik team
 answered on 29 Oct 2024
1 answer
101 views

Hi Team,

I am using CardActionsListView to display the images.

This works fine with Android and IOS, whereas in WINUI when uploaded an image it shows duplicate images, when refreshed the list it shows only one.

 

Can you provide any fix for this.

 

Thanks & Best Regards,

Mohammed Rameez Raza (Rameez)

Yana
Telerik team
 answered on 22 Oct 2024
1 answer
78 views

I have the followin MainPage.xaml

 


<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:dataControls="http://schemas.telerik.com/2022/xaml/maui"
             xmlns:mauiApp8="clr-namespace:MauiApp8"
             x:Class="MauiApp8.MainPage"
             BindingContext="{Binding Source={RelativeSource Self}}">

    <Grid Margin="10"
          ColumnDefinitions="Auto, Auto, *">
        <dataControls:RadListView Grid.Column="0"
                                  ItemsSource="{Binding FooItems}">
            <dataControls:RadListView.ItemTemplate>
                <DataTemplate x:DataType="{x:Type mauiApp8:Foo}">
                    <dataControls:ListViewTemplateCell>
                        <dataControls:ListViewTemplateCell.View>
                            <Grid ColumnDefinitions="Auto, Auto"
                                  Padding="0, 4">
                                <Label Text="{Binding Name}"
                                       TextColor="{Binding Name}" />
                                <Label Text="{Binding Description}"
                                       Grid.Column="1" />
                            </Grid>
                        </dataControls:ListViewTemplateCell.View>
                    </dataControls:ListViewTemplateCell>
                </DataTemplate>
            </dataControls:RadListView.ItemTemplate>
        </dataControls:RadListView>

        <ListView Grid.Column="1"
                  ItemsSource="{Binding FooItems}">
            <ListView.ItemTemplate>
                <DataTemplate x:DataType="{x:Type mauiApp8:Foo}">
                    <ViewCell>
                        <Grid ColumnDefinitions="Auto, Auto"
                              Padding="0, 4">
                            <Label Text="{Binding Name}"
                                   TextColor="{Binding Name}" />
                            <Label Text="{Binding Description}"
                                   Grid.Column="1" />
                        </Grid>
                    </ViewCell>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>

        <Border Grid.Column="2"
                Background="Green" />
    </Grid>
</ContentPage>

Why doesn't the RadListView auto size the items correctly?

First column (red circle) is the RadListView which is cutoff.

Second column is the normal ListView which displays the text fully.

Code behind if needed is this:

 


public partial class MainPage : ContentPage
{
    public List<Foo> FooItems { get; set; }

    public MainPage()
    {
        FooItems =
        [
            new Foo("Hello", "Hello World this is a long text"),
            new Foo("Hello", "Hello World this is a very very very long text")
        ];

        InitializeComponent();
    }
}

public class Foo
{
    public string Name { get; set; }
    public string Description { get; set; }

    public Foo(string name, string description)
    {
        Name = name;
        Description = description;
    }
}

Didi
Telerik team
 answered on 10 Oct 2024
1 answer
81 views
So I am running into an issue where the content of the listview may be updated or changed, but the sorting does not reflect the changes.  Is there a way trigger the listview to resort the list without clearing the sorting descriptors and adding them back?
Yana
Telerik team
 answered on 07 Aug 2024
1 answer
95 views
Using the example from: https://docs.telerik.com/devtools/maui/controls/listview/sorting#propertysortdescriptor

I am having issues adding a PropertySortDescriptor to ObservableCollection<SortDescriptorBase> without getting a type error.



I have tried playing around with things and I just can't seem to get it working based on the reference I have.  Any ideas?  I have tried using listView.SortDescriptors.Add without luck... I have tried binding it to a collection per the docks to no avail, and I've tried to move the types around to see if I can get a better result... nothing seems to work?


        _radListViewModel.SortDescriptors.Add(new PropertySortDescriptor() { PropertyName = "PickupNumber", SortOrder = SortOrder.Ascending }); // Conversion Error
        listView.SortDescriptors.Add(new PropertySortDescriptor() { PropertyName = "SchedArriveEarly", SortOrder = SortOrder.Ascending }); // Conversion Error
        listView.SortDescriptors.Add(new Telerik.Maui.Controls.Compatibility.DataControls.ListView.SortDescriptorBase() { PropertyName = "PickupNumber", SortOrder = SortOrder.Ascending }); // Error, its a type and cannot be used to create an instance


Didi
Telerik team
 answered on 24 Jul 2024
0 answers
95 views

I have the following:

<telerik:RadListView              
    Margin="10"
    IsPullToRefreshActive="{Binding LoadItemsTask.IsNotCompleted}"
    IsPullToRefreshEnabled="True"  Grid.Row="2" x:Name="listView" ItemsSource="{Binding Items}" >
(...)
</telerik:RadListView>

LoadItemsTask is called at start and its value is True for a few seconds but the refresh indicator only shows up (and eventually hides) when the pull gesture is called, it does not respond to the initial value of the property.

Shouldn't this property be respected always, not just when the gesture is called?


Alfredo
Top achievements
Rank 1
 updated question on 07 Jun 2024
1 answer
478 views

From the Help Page...

The ListView provides UI virtualization, which requires the visual parent to provide vertical or horizontal space. To avoid breaking UI virtualization or gesture mechanisms:

  • Do not place the ListView inside a StackLayout or inside a ScrollView.
  • Do not set the ListView to a RowDefinition Height="Auto" Grid definition.

 

Does this mean that a ListView cant be placed as a child of a Scroll View under any circumstance, or its immediate parent cant be a ScrollView? Same question for the Grid RowDefinition. If using nested grids, must all parent grids rows have a Height specified, or is it only the immediate parent? Also is * ok for the Height?

Seems like ListView is severely limited to being the only control on the page/view if this is the case.

Didi
Telerik team
 answered on 06 May 2024
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?