RadTreeView during rendering. I tried to comment out all of the Templete overrides in the resource dictionary AND I've also removed the <fluent:MauiIcon> in the ItemTemplate.
Unable to cast object of type 'Telerik.Maui.Handlers.RadButtonHandler' to type 'Microsoft.Maui.Platform.IImageSourcePartSetter'.
at Microsoft.Maui.Platform.ImageSourcePartLoader..ctor(IElementHandler handler, Func`1 imageSourcePart, Action`1 setImage)
at Telerik.Maui.Handlers.RadButtonHandler..ctor(IPropertyMapper mapper)
at Telerik.Maui.Handlers.RadButtonHandler..ctor()
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions)
at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement view, IMauiContext context)
at Microsoft.Maui.Platform.ElementExtensions.ToPlatform(IElement view, IMauiContext context)
at Microsoft.Maui.Handlers.LayoutHandler.SetVirtualView(IView view)
at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler)
at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement view, IMauiContext context)
at Microsoft.Maui.Platform.ElementExtensions.ToPlatform(IElement view, IMauiContext context)
at Microsoft.Maui.Handlers.LayoutHandler.SetVirtualView(IView view)
at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler)
at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement view, IMauiContext context)
at Microsoft.Maui.Platform.ElementExtensions.ToPlatform(IElement view, IMauiContext context)
at Telerik.Maui.RadBorderExtensions.UpdateBorderContent(Border nativeBorder, IRadBorder border)
at Telerik.Maui.Handlers.RadBorderHandler.MapContent(RadBorderHandler handler, IRadBorder border)
at Microsoft.Maui.PropertyMapper.UpdateProperties(IElementHandler viewHandler, IElement virtualView)
at Microsoft.Maui.Handlers.ElementHandler.SetVirtualView(IElement view)
at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler)
at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement view, IMauiContext context)
at Microsoft.Maui.Platform.ElementExtensions.ToPlatform(IElement view, IMauiContext context)
at Microsoft.Maui.Handlers.ContentViewHandler.UpdateContent(IContentViewHandler handler)
at Microsoft.Maui.Handlers.ContentViewHandler.MapContent(IContentViewHandler handler, IContentView page)
at Microsoft.Maui.Controls.TemplatedView.OnApplyTemplateImpl()
at Microsoft.Maui.Controls.TemplatedView.OnApplyTemplate()
at Microsoft.Maui.Controls.TemplatedView.Microsoft.Maui.Controls.IControlTemplated.OnApplyTemplate()
at Microsoft.Maui.Controls.TemplateUtilities.OnControlTemplateChanged(BindableObject bindable, Object oldValue, Object newValue)
at Microsoft.Maui.Controls.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, SetterSpecificity specificity, Boolean silent)
at Microsoft.Maui.Controls.BindableObject.SetValue(BindableProperty property, Object value)
at Telerik.Maui.Controls.RadCompositeContentView.set_ActualControlTemplate(ControlTemplate value)
at Telerik.Maui.Controls.RadCompositeContentView.UpdateActualControlTemplate(ControlTemplate customTemplate)
at Telerik.Maui.Controls.RadCompositeContentView.UpdateActualControlTemplate()
at Telerik.Maui.Controls.RadCompositeContentView.InitializeComponent()
at Telerik.Maui.Controls.RadCompositeContentView.OnHandlerChanged()
at Telerik.Maui.Controls.ItemsView.ItemView.OnHandlerChanged()
at Microsoft.Maui.Controls.VisualElement.OnHandlerChangedCore()
at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler)
at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement view, IMauiContext context)
at Microsoft.Maui.Platform.ElementExtensions.ToPlatform(IElement view, IMauiContext context)
at Microsoft.Maui.Handlers.LayoutHandler.Add(IView child)
at Microsoft.Maui.Handlers.LayoutHandler.MapAdd(ILayoutHandler handler, ILayout layout, Object arg)
at Microsoft.Maui.CommandMapper.InvokeCore(String key, IElementHandler viewHandler, IElement virtualView, Object args)
at Microsoft.Maui.Handlers.ElementHandler.Invoke(String command, Object args)
at Microsoft.Maui.Controls.Layout.NotifyHandler(String action, Int32 index, IView view)
at Microsoft.Maui.Controls.Layout.OnAdd(Int32 index, IView view)
at Microsoft.Maui.Controls.Layout.Add(IView child)
at Telerik.Maui.Controls.RadItemsView.CreateItemView()
at Telerik.Maui.Controls.RadItemsView.Telerik.Maui.Controls.ItemsView.IRadItemsView.CreateItemView()
at Telerik.Maui.Controls.ItemsView.ItemViewProvider.CreateItemView(Object dataItem)
at Telerik.Maui.Controls.ItemsView.ItemViewProvider.GetItemView(Object dataItem)
at Telerik.Maui.Controls.ItemsView.ItemsViewVerticalLayoutStrategy.GetItemView(Object dataItem)
at Telerik.Maui.Controls.ItemsView.ItemsViewVerticalLayoutStrategy.GetItemView(Int32 itemIndex)
at Telerik.Maui.Controls.ItemsView.ItemsViewVerticalLayoutStrategy.ExpandEnd(Size availableSize)
at Telerik.Maui.Controls.ItemsView.ItemsViewVerticalLayoutStrategy.ArrangeChildren(Rect layoutBounds)
at Telerik.Maui.Controls.ItemsView.ItemsVirtualLayout.ArrangeChildren(Rect layoutBounds)
at Microsoft.Maui.Platform.LayoutPanel.ArrangeOverride(Size finalSize)
at ABI.Microsoft.UI.Xaml.IFrameworkElementOverrides.Do_Abi_ArrangeOverride_1(IntPtr thisPtr, Size finalSize, Size* result)
--- End of stack trace from previous location ---
at WinRT.ExceptionHelpers.<ThrowExceptionForHR>g__Throw|20_0(Int32 hr)
at Microsoft.Maui.ViewHandlerExtensions.PlatformArrangeHandler(IViewHandler viewHandler, Rect rect)
at Microsoft.Maui.Controls.VisualElement.ArrangeOverride(Rect bounds)
at Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IView.Arrange(Rect bounds)
at Telerik.Maui.Controls.ItemsView.ItemsScrollLayout.ArrangeChildren(Rect layoutBounds)
at Microsoft.Maui.Platform.LayoutPanel.ArrangeOverride(Size finalSize)
at ABI.Microsoft.UI.Xaml.IFrameworkElementOverrides.Do_Abi_ArrangeOverride_1(IntPtr thisPtr, Size finalSize, Size* result)
--- End of stack trace from previous location ---
at WinRT.ExceptionHelpers.<ThrowExceptionForHR>g__Throw|20_0(Int32 hr)
at Microsoft.Maui.ViewHandlerExtensions.PlatformArrangeHandler(IViewHandler viewHandler, Rect rect)
at Microsoft.Maui.Controls.VisualElement.ArrangeOverride(Rect bounds)
at Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IView.Arrange(Rect bounds)
at Microsoft.Maui.Layouts.GridLayoutManager.ArrangeChildren(Rect bounds)
at Microsoft.Maui.Platform.LayoutPanel.ArrangeOverride(Size finalSize)
at ABI.Microsoft.UI.Xaml.IFrameworkElementOverrides.Do_Abi_ArrangeOverride_1(IntPtr thisPtr, Size finalSize, Size* result)
--- End of stack trace from previous location ---
at WinRT.ExceptionHelpers.<ThrowExceptionForHR>g__Throw|20_0(Int32 hr)
at Microsoft.Maui.ViewHandlerExtensions.PlatformArrangeHandler(IViewHandler viewHandler, Rect rect)
at Microsoft.Maui.Controls.VisualElement.ArrangeOverride(Rect bounds)
at Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IView.Arrange(Rect bounds)
at Microsoft.Maui.Controls.Compatibility.Layout.LayoutChildIntoBoundingRegion(VisualElement child, Rect region)
at Microsoft.Maui.Controls.TemplatedView.LayoutChildren(Double x, Double y, Double width, Double height)
at Microsoft.Maui.Controls.Compatibility.Layout.UpdateChildrenLayout()
at Microsoft.Maui.Controls.VisualElement.UpdateBoundsComponents(Rect bounds)
at Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IView.Arrange(Rect bounds)
at Microsoft.Maui.Controls.Compatibility.Layout.LayoutChildIntoBoundingRegion(VisualElement child, Rect region)
at Microsoft.Maui.Controls.TemplatedView.LayoutChildren(Double x, Double y, Double width, Double height)
at Microsoft.Maui.Controls.Compatibility.Layout.UpdateChildrenLayout()
at Microsoft.Maui.Controls.VisualElement.UpdateBoundsComponents(Rect bounds)
at Microsoft.Maui.Controls.VisualElement.set_Frame(Rect value)
at Microsoft.Maui.Controls.TemplatedView.ArrangeOverride(Rect bounds)
at Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IView.Arrange(Rect bounds)
at Microsoft.Maui.Layouts.GridLayoutManager.ArrangeChildren(Rect bounds)
at Microsoft.Maui.Platform.LayoutPanel.ArrangeOverride(Size finalSize)
at ABI.Microsoft.UI.Xaml.IFrameworkElementOverrides.Do_Abi_ArrangeOverride_1(IntPtr thisPtr, Size finalSize, Size* result)
--- End of stack trace from previous location ---
at WinRT.ExceptionHelpers.<ThrowExceptionForHR>g__Throw|20_0(Int32 hr)
at Microsoft.Maui.ViewHandlerExtensions.PlatformArrangeHandler(IViewHandler viewHandler, Rect rect)
at Microsoft.Maui.Controls.VisualElement.ArrangeOverride(Rect bounds)
at Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IView.Arrange(Rect bounds)
at Microsoft.Maui.Controls.Compatibility.Layout.LayoutChildIntoBoundingRegion(VisualElement child, Rect region)
at Microsoft.Maui.Controls.Page.LayoutChildren(Double x, Double y, Double width, Double height)
at Microsoft.Maui.Controls.Page.UpdateChildrenLayout()
at Microsoft.Maui.Controls.Page.OnSizeAllocated(Double width, Double height)
at Microsoft.Maui.Controls.VisualElement.UpdateBoundsComponents(Rect bounds)
at Microsoft.Maui.Controls.VisualElement.set_Frame(Rect value)
at Microsoft.Maui.Controls.ContentPage.Microsoft.Maui.ICrossPlatformLayout.CrossPlatformArrange(Rect bounds)
at Microsoft.Maui.Platform.ContentPanel.ArrangeOverride(Size finalSize)
at ABI.Microsoft.UI.Xaml.IFrameworkElementOverrides.Do_Abi_ArrangeOverride_1(IntPtr thisPtr, Size finalSize, Size* result)
--- End of stack trace from previous location ---
at WinRT.ExceptionHelpers.<ThrowExceptionForHR>g__Throw|20_0(Int32 hr)
at ABI.Microsoft.UI.Xaml.IFrameworkElementOverridesMethods.ArrangeOverride(IObjectReference _obj, Size finalSize)
at Microsoft.UI.Xaml.FrameworkElement.ArrangeOverride(Size finalSize)
at ABI.Microsoft.UI.Xaml.IFrameworkElementOverrides.Do_Abi_ArrangeOverride_1(IntPtr thisPtr, Size finalSize, Size* result)
--- End of stack trace from previous location ---
at WinRT.ExceptionHelpers.<ThrowExceptionForHR>g__Throw|20_0(Int32 hr)
at ABI.Microsoft.UI.Xaml.IFrameworkElementOverridesMethods.ArrangeOverride(IObjectReference _obj, Size finalSize)
at Microsoft.UI.Xaml.FrameworkElement.ArrangeOverride(Size finalSize)
at ABI.Microsoft.UI.Xaml.IFrameworkElementOverrides.Do_Abi_ArrangeOverride_1(IntPtr thisPtr, Size finalSize, Size* result)
--- End of stack trace from previous location ---
at WinRT.ExceptionHelpers.<ThrowExceptionForHR>g__Throw|20_0(Int32 hr)
at Microsoft.UI.Xaml.UIElement.Arrange(Rect finalRect)
at Microsoft.Maui.Platform.WindowRootViewContainer.ArrangeOverride(Size finalSize)
at ABI.Microsoft.UI.Xaml.IFrameworkElementOverrides.Do_Abi_ArrangeOverride_1(IntPtr thisPtr, Size finalSize, Size* result)
Xaml:
<telerik:RadTreeView
x:Name="treeview"
Grid.Row="2"
AutomationId="treeview"
CheckBoxMode="None"
ItemStyle="{StaticResource Key=TreeViewStyle1}"
ItemsSource="{Binding SqlPlan.SparkPlanInfos}"
LevelIndentation="10">
<telerik:TreeViewDescriptor ItemsSourcePath="Children" TargetType="{x:Type models:SparkPlanInfo}" />
<telerik:RadTreeView.ItemTemplate>
<DataTemplate x:DataType="models:SparkPlanInfo">
<Grid ColumnDefinitions="auto,auto,*,auto">
<fluent:MauiIcon
Margin="-15,5,10,0"
Icon="{Binding NodeName, Converter={StaticResource SparkOperationToIconKey}, ConverterParameter='16', FallbackValue={x:Static fluent:FluentIcons.Accessibility16}}"
IconColor="Black"
IconSize="16" />
<Label
Grid.Column="1"
LineBreakMode="WordWrap"
Text="{Binding NodeName}"
VerticalOptions="Center" />
<Label
Grid.Column="2"
Margin="20,0"
HorizontalOptions="Start"
HorizontalTextAlignment="Start"
IsVisible="{Binding IsSimpleStringUnequalToNodeName}"
LineBreakMode="NoWrap"
MaximumWidthRequest="600"
Text="{Binding SimpleStringWithoutStartingNodeName}"
ToolTipProperties.Text="{Binding SimpleString}"
VerticalOptions="Center" />
</Grid>
</DataTemplate>
</telerik:RadTreeView.ItemTemplate>
</telerik:RadTreeView>
<ContentPage.Resources>
<ResourceDictionary>
<converters:SparkOperationToIconConverter x:Key="SparkOperationToIconKey" />
<ControlTemplate x:Key="TreeViewTemplate1">
<telerik:RadBorder
Padding="{TemplateBinding ContentPadding}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderColor="{TemplateBinding BorderColor}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<telerik:TreeViewItemLayout Indentation="{TemplateBinding Indentation}" Spacing="{TemplateBinding Spacing}">
<telerik:TreeViewItemExpandButton
Command="{TemplateBinding ToggleExpandedCommand}"
IsEnabled="{TemplateBinding IsEnabled}"
IsExpanded="{TemplateBinding IsExpanded}"
IsLeaf="{TemplateBinding IsLeaf}"
IsVisible="{TemplateBinding IsExpandButtonVisible}"
Style="{TemplateBinding ExpandButtonStyle}"
TextColor="{TemplateBinding TextColor}" />
<telerik:TreeViewItemCheckBox
IsChecked="{TemplateBinding IsChecked}"
IsEnabled="{TemplateBinding IsEnabled}"
IsVisible="{TemplateBinding IsCheckBoxVisible}"
Style="{TemplateBinding CheckBoxStyle}" />
<telerik:TreeViewItemImage
IsEnabled="{TemplateBinding IsEnabled}"
IsVisible="{TemplateBinding IsImageVisible}"
Source="{TemplateBinding ImageSource}"
Style="{TemplateBinding ImageStyle}" />
<!-- content presenter for presenting the (ItemTemplate/Text if itemtemplate is not used) -->
<ContentPresenter />
</telerik:TreeViewItemLayout>
</telerik:RadBorder>
</ControlTemplate>
<Style x:Key="TreeViewStyle1" TargetType="telerik:TreeViewItemView">
<!-- control template can be defined through style -->
<Setter Property="ControlTemplate" Value="{StaticResource TreeViewTemplate1}" />
<Setter Property="IsImageVisible" Value="True" />
</Style>
</ResourceDictionary>
</ContentPage.Resources>
This is also happening in RadDataGrid upon clicking to filter items via a column header:
at Microsoft.Maui.Hosting.Internal.MauiFactory.GetService(Type serviceType, ServiceDescriptor single, IEnumerable`1 enumerable)
at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement view, IMauiContext context)
at Microsoft.Maui.Platform.ElementExtensions.ToPlatform(IElement view, IMauiContext context)
at Microsoft.Maui.Handlers.LayoutHandler.SetVirtualView(IView view)
at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler)
at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement view, IMauiContext context)
at Microsoft.Maui.Platform.ElementExtensions.ToPlatform(IElement view, IMauiContext context)
at Microsoft.Maui.Handlers.LayoutHandler.SetVirtualView(IView view)
at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler)
at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement view, IMauiContext context)
at Microsoft.Maui.Platform.ElementExtensions.ToPlatform(IElement view, IMauiContext context)
at Telerik.Maui.RadBorderExtensions.UpdateBorderContent(Border nativeBorder, IRadBorder border)
at Telerik.Maui.Handlers.RadBorderHandler.MapContent(RadBorderHandler handler, IRadBorder border)
at Microsoft.Maui.PropertyMapper.UpdatePropertyCore(String key, IElementHandler viewHandler, IElement virtualView)
at Microsoft.Maui.PropertyMapper.UpdateProperties(IElementHandler viewHandler, IElement virtualView)
at Microsoft.Maui.Handlers.ElementHandler.SetVirtualView(IElement view)
at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler)
at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement view, IMauiContext context)
at Microsoft.Maui.Platform.ElementExtensions.ToPlatform(IElement view, IMauiContext context)
at Microsoft.Maui.Handlers.LayoutHandler.SetVirtualView(IView view)
at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler)
at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement view, IMauiContext context)
at Microsoft.Maui.Platform.ElementExtensions.ToPlatform(IElement view, IMauiContext context)
at Microsoft.Maui.Handlers.LayoutHandler.SetVirtualView(IView view)
at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler)
at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement view, IMauiContext context)
at Microsoft.Maui.Platform.ElementExtensions.ToPlatform(IElement view, IMauiContext context)
at Microsoft.Maui.Handlers.LayoutHandler.SetVirtualView(IView view)
at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler)
at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement view, IMauiContext context)
at Microsoft.Maui.Platform.ElementExtensions.ToPlatform(IElement view, IMauiContext context)
at Microsoft.Maui.Handlers.ContentViewHandler.UpdateContent(IContentViewHandler handler)
at Microsoft.Maui.Handlers.ContentViewHandler.MapContent(IContentViewHandler handler, IContentView page)
at Microsoft.Maui.PropertyMapper.UpdatePropertyCore(String key, IElementHandler viewHandler, IElement virtualView)
at Microsoft.Maui.PropertyMapper.UpdateProperties(IElementHandler viewHandler, IElement virtualView)
at Microsoft.Maui.Handlers.ElementHandler.SetVirtualView(IElement view)
at Microsoft.Maui.Handlers.ContentViewHandler.SetVirtualView(IView view)
at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler)
at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement view, IMauiContext context)
at Microsoft.Maui.Platform.ElementExtensions.ToPlatform(IElement view, IMauiContext context)
at Telerik.Maui.Controls.RadPopup.EnsurePopupContent()
at Telerik.Maui.Controls.RadPopup.UpdatePopupContent()
at Telerik.Maui.Controls.PopupBase.OnContentChanged(View oldValue, View newValue)
at Telerik.Maui.Controls.PopupBase.<>c.<.cctor>b__124_1(BindableObject b, Object o, Object n)
at Microsoft.Maui.Controls.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, SetterSpecificity specificity, Boolean silent)
at Microsoft.Maui.Controls.BindableObject.SetValue(BindableProperty property, Object value)
at Telerik.Maui.Controls.PopupBase.set_Content(View value)
at Telerik.Maui.Controls.Compatibility.DataGrid.RadDataGrid.InitializeFilterUIPopup(OptionsTapContext optionsTapContext)
at Telerik.Maui.Controls.Compatibility.DataGrid.Commands.FilterTapCommand.Execute(Object parameter)
at Telerik.Maui.Controls.CommandServiceBase`1.ExecuteCommandCore(Int32 id, Object parameter, Boolean searchUser)
at Telerik.Maui.Controls.Compatibility.DataGrid.Commands.DataGridCommandService.ExecuteCommand(DataGridCommandId id, Object parameter)
at Telerik.Maui.Controls.Compatibility.DataGrid.RadDataGrid.OnColumnHeaderTap(ITouchLocation args, Boolean isFrozen)
at Telerik.Maui.Controls.Compatibility.DataGrid.DataGridColumnHeaderPanel.OnColumnHeaderTapped(Object sender, ITouchLocation args)
at Telerik.Maui.NativeGestureRecognizer.NativeView_Tapped(Object sender, TappedRoutedEventArgs e)
at WinRT._EventSource_global__Microsoft_UI_Xaml_Input_TappedEventHandler.EventState.<GetEventInvoke>b__1_0(Object sender, TappedRoutedEventArgs e)
at ABI.Microsoft.UI.Xaml.Input.TappedEventHandler.Do_Abi_Invoke(IntPtr thisPtr, IntPtr sender, IntPtr e)