Hello,
I got a RadTreeView with 1000 items and using Virtualization.
Its definition is:
I'm using a style to set all RadTreeViewItem a context menu like that:
contextDevice is a really simple context menu. with one RadMenuItem in it.
The problem: when scrolling to the bottom of the list and right click an item, the context menu opens fine. But when i scroll back to top of the tree, and right click an item, i get the following exception:
Please note that when i set IsVirtualizing=false the problem is solved ! but i get really bad memory consume
Thanks for your help.
Miky.
I got a RadTreeView with 1000 items and using Virtualization.
Its definition is:
<telerik:RadTreeView x:Name="MyTree" ContextMenu="{StaticResource ResourceKey=contextManager}" IsEditable="true" Grid.Row="1" ItemsSource="{Binding Path=Devices.Children}" IsLineEnabled="True" SelectionMode="Extended" ItemTemplateSelector="{StaticResource ItemSelector}" ItemContainerStyleSelector="{StaticResource ItemContainerSelector}" IsVirtualizing="true" IsDragDropEnabled="True" IsDragPreviewEnabled="True" IsDragTooltipEnabled="True" IsDropPreviewLineEnabled="True" PreviewDragEnded="TreeView_DragEnded"/><Style x:Key="DeviceContainerStyle" TargetType="telerik:RadTreeViewItem"> <Setter Property="IsSelected" Value="{Binding IsSelected,Mode=TwoWay}"/> <Setter Property="IsEditable" Value="False"/> <Setter Property="IsExpanded" Value="{Binding IsExpanded,Mode=TwoWay}"/> <Setter Property="telerik:RadContextMenu.ContextMenu" Value="{StaticResource ResourceKey=contextDevice}" /> </Style>The problem: when scrolling to the bottom of the list and right click an item, the context menu opens fine. But when i scroll back to top of the tree, and right click an item, i get the following exception:
Message: Value cannot be null. Parameter name: formatStack Trace: at System.String.Format(IFormatProvider provider, String format, Object[] args) at Telerik.Windows.Controls.SRLoader`1.GetString(String defaultNamespace, String name, Object[] args) in c:\Builds\WPF_Scrum\Current_HotFix\Sources\Development\Core\Controls\SRLoader.cs:line 78 at Telerik.Windows.Controls.SR.GetString(String name, Object[] args) in c:\Builds\WPF_Scrum\Current_HotFix\Sources\Development\Core\Controls\SR.cs:line 33 at Telerik.Windows.Controls.RadContextMenu.CreateRootPopup(Popup popup, UIElement child) in c:\Builds\WPF_Scrum\Current_HotFix\Sources\Development\Controls\Navigation\Menu\ContextMenu.cs:line 767 at Telerik.Windows.Controls.RadContextMenu.HookupRootPopup() in c:\Builds\WPF_Scrum\Current_HotFix\Sources\Development\Controls\Navigation\Menu\ContextMenu.cs:line 1168 at Telerik.Windows.Controls.RadContextMenu.OnIsOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) in c:\Builds\WPF_Scrum\Current_HotFix\Sources\Development\Controls\Navigation\Menu\ContextMenu.cs:line 658 at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e) at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e) at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args) at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType) at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal) at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value) at Telerik.Windows.Controls.RadContextMenu.set_IsOpen(Boolean value) in c:\Builds\WPF_Scrum\Current_HotFix\Sources\Development\Controls\Navigation\Menu\ContextMenu.cs:line 318 at Telerik.Windows.Controls.RadContextMenu.TriggerEventFired() in c:\Builds\WPF_Scrum\Current_HotFix\Sources\Development\Controls\Navigation\Menu\ContextMenu.cs:line 899 at Telerik.Windows.Controls.RadContextMenu.OnEventTriggered(Object sender, EventArgs e) in c:\Builds\WPF_Scrum\Current_HotFix\Sources\Development\Controls\Navigation\Menu\ContextMenu.cs:line 864 at Telerik.Windows.Controls.RadContextMenu.RoutedEventFired(Object sender, RoutedEventArgs e) in c:\Builds\WPF_Scrum\Current_HotFix\Sources\Development\Controls\Navigation\Menu\ContextMenu.cs:line 1059 at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent) at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e) at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget) at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args) at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args) at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted) at System.Windows.Input.InputManager.ProcessStagingArea() at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input) at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport) at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel) at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)Please note that when i set IsVirtualizing=false the problem is solved ! but i get really bad memory consume
Thanks for your help.
Miky.