Hi Team,
We are facing the below exception in our applicaiton. Currently we are using version 4.0 telerik radtreeview in our application . can you please confirm whether it is related version issue or any other reason and How to resolve this issue?
Stack Trace:
Timestamp: 3/23/2021
15:58:17 Message:
HandlingInstanceID: c392afd7-c81e-4acf-86d3-2bc248a1b9ab
An exception of type 'System.NullReferenceException' occurred and was
caught.
-----------------------------------------------------------------------------
03/23/2021 11:58:17
Type : System.NullReferenceException, mscorlib, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089
Message : AUID = 724 - Object reference not set to an instance of an
object.
Source : PresentationFramework
Help link :
Data : System.Collections.ListDictionaryInternal
TargetSite : Void
Remove(System.Windows.Controls.Primitives.GeneratorPosition, Int32, Boolean)
HResult : -2147467261
Stack Trace : at
System.Windows.Controls.ItemContainerGenerator.Remove(GeneratorPosition
position, Int32 count, Boolean isRecycling)
at
Telerik.Windows.Controls.TreeView.TreeViewPanel.CleanupRange(IList children,
IItemContainerGenerator generator, Int32 startIndex, Int32 count)
at Telerik.Windows.Controls.TreeView.TreeViewPanel.CleanupContainers(Int32
firstViewport, ItemsControl itemsControl)
at
Telerik.Windows.Controls.TreeView.TreeViewPanel.MeasureOverride(Size
constraint)
at System.Windows.FrameworkElement.MeasureCore(Size
availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at
MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size
constraint)
at
System.Windows.Controls.ItemsPresenter.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size
availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.Grid.MeasureCell(Int32 cell,
Boolean forceInfinityV)
at System.Windows.Controls.Grid.MeasureCellsGroup(Int32
cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean
forceInfinityV, Boolean& hasDesiredSizeUChanged)
at System.Windows.Controls.Grid.MeasureOverride(Size
constraint)
at System.Windows.FrameworkElement.MeasureCore(Size
availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.Control.MeasureOverride(Size
constraint)
at
Telerik.Windows.Controls.RadTreeViewItem.MeasureOverride(Size availableSize)
at System.Windows.FrameworkElement.MeasureCore(Size
availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at
Telerik.Windows.Controls.TreeView.TreeViewPanel.MeasureOverride(Size
constraint)
at System.Windows.FrameworkElement.MeasureCore(Size
availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at
MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size
constraint)
at
System.Windows.Controls.ItemsPresenter.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size
availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at
MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size
constraint)
at System.Windows.Controls.ScrollContentPresenter.MeasureOverride(Size
constraint)
at System.Windows.FrameworkElement.MeasureCore(Size
availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.Grid.MeasureCell(Int32 cell,
Boolean forceInfinityV)
at System.Windows.Controls.Grid.MeasureCellsGroup(Int32
cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean
forceInfinityV, Boolean& hasDesiredSizeUChanged)
at System.Windows.Controls.Grid.MeasureOverride(Size
constraint)
at System.Windows.FrameworkElement.MeasureCore(Size
availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at
System.Windows.Controls.ScrollViewer.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.Grid.MeasureOverride(Size
constraint)
at System.Windows.FrameworkElement.MeasureCore(Size
availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.Border.MeasureOverride(Size
constraint)
at System.Windows.FrameworkElement.MeasureCore(Size
availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.Grid.MeasureOverride(Size
constraint)
at System.Windows.FrameworkElement.MeasureCore(Size
availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.Control.MeasureOverride(Size
constraint)
at System.Windows.FrameworkElement.MeasureCore(Size
availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.Border.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size
availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.Grid.MeasureCell(Int32 cell,
Boolean forceInfinityV)
at System.Windows.Controls.Grid.MeasureCellsGroup(Int32
cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean
forceInfinityV, Boolean& hasDesiredSizeUChanged)
at System.Windows.Controls.Grid.MeasureOverride(Size
constraint)
at System.Windows.FrameworkElement.MeasureCore(Size
availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.Grid.MeasureCell(Int32 cell,
Boolean forceInfinityV)
at System.Windows.Controls.Grid.MeasureCellsGroup(Int32
cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean
forceInfinityV, Boolean& hasDesiredSizeUChanged)
at System.Windows.Controls.Grid.MeasureOverride(Size
constraint)
at System.Windows.FrameworkElement.MeasureCore(Size
availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at
MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size
constraint)
at
System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size
availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.Border.MeasureOverride(Size
constraint)
at System.Windows.FrameworkElement.MeasureCore(Size
availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.Control.MeasureOverride(Size
constraint)
at System.Windows.FrameworkElement.MeasureCore(Size
availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.ContextLayoutManager.UpdateLayout()
at
System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
at
System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
at
System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object
resizedCompositionTarget)
at System.Windows.Media.MediaContext.RenderMessageHandler(Object
resizedCompositionTarget)
at
System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback,
Object args, Int32 numArgs)
at
System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate
callback, Object args, Int32 numArgs, Delegate catchHandler)
Thanks,
Srinivasan
private void OnAddFolderClicked(object sender, RoutedEventArgs e) |
{ |
IFolderContainer container = (sender as MenuItem).DataContext as IFolderContainer ?? null; |
Folder folder = new Folder() { Name = "Folder" }; |
container.AddFolder(folder); |
treeViewExplorer.SelectedItem = folder; |
folder.IsNodeInEditMode = true; |
RadTreeViewItem selectedItem = treeViewExplorer.SelectedContainer; // this is null even though I set the SelectedItem = folder |
} |
Hello,
I have a treeView and I want to bind each item command, command parameter and IsEnabled properties. If I bind just the IsEnabled property it works, but if I add the command binding, the command works, but IsEnabled binding breaks.
I use the following code:
<
telerik:RadTreeView
ItemsSource
=
"{Binding TreeViewModel.Categories}"
Grid.Row
=
"0"
>
<
telerik:RadTreeView.ItemTemplate
>
<
HierarchicalDataTemplate
ItemsSource
=
"{Binding SubCategories}"
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
TextBlock
VerticalAlignment
=
"Center"
Text
=
"{Binding Name}"
/>
</
StackPanel
>
</
HierarchicalDataTemplate
>
</
telerik:RadTreeView.ItemTemplate
>
<
telerik:RadTreeView.ItemContainerStyle
>
<
Style
TargetType
=
"telerik:RadTreeViewItem"
BasedOn
=
"{StaticResource RadTreeViewItemStyle}"
>
<
Setter
Property
=
"IsEnabled"
Value
=
"{Binding IsEnabled}"
/>
<
Setter
Property
=
"Command"
Value
=
"{Binding Path=DataContext.GoToTabCommand, RelativeSource={RelativeSource AncestorType=telerik:RadWindow}}"
/>
<
Setter
Property
=
"CommandParameter"
Value
=
"{Binding Name}"
/>
</
Style
>
</
telerik:RadTreeView.ItemContainerStyle
>
</
telerik:RadTreeView
>
How can I make both bindings to work?
I am using the "UI for WPF Q1 2016" release, WPF, .NET Framework 4.6.1, Windows 10 and C#.
I am trying to implement drag and drop within a single RadTreeView. The default drag visual has a great structure, but has some problems for me. (The background of the drag item is dark and I can't read the dragged item's name, and the drop tooltip seems to be calling ToString() on my viewmodel, and that is not the text that I want.)
Researching, the page "Customize the TreeViewDragVisual" (https://docs.telerik.com/devtools/wpf/controls/radtreeview/how-to/customize-treeviewdragvisual)
tells me to derive from RadTreeView and to modify the template. But I am using NoXaml binaries and this page indicates that I must set the control template in app.xaml. Therefore it will apply to all RadTreeViews, and this doesn't seem like what I want to do.
Then I find the forum post on modifying the tooltip (https://www.telerik.com/forums/treeview---how-to-modify-the-drag-drop-drag-tooltip-target-part)
which points me at the DragDropManager. The manager has a "Set Drag Visual" topic (https://docs.telerik.com/devtools/wpf/controls/dragdropmanager/how-to/dragdrompmanager-howto-set-drag-visual) which says to handle DragDropManager.AddDragInitializeHandler and create a new drag visual in
the handler. This seems better than modifying app.xaml.
Also DragDropManager has the topic "Customizing the DragVisual" (https://docs.telerik.com/devtools/wpf/controls/dragdropmanager/behaviors/customizingdragvisual) which talks about implementing IDragVisualProvider. But the example is for ListBox and I'm using a RadTreeView.
So I'm all kinds of confused.
First, I need to fix the drag visual. I like the Drop Preview Line, the Drag Preview, and the Drag Tooltip parts. I need to change the Drag Preview and the Drag Tooltip.
Then I need to handle the "drop", which I think is done by attaching my own handler to DragDropManager.Drop event.
Thanks for any help.
-John.
Hi
I tried the dark Fluent style for RadTreeView but it didn't work well.
where is the problem from?
Look at the pictures
Hello,
we're currently updating our application to use Telerik components in order to make use of implicit styling.
I'm making good progress so far but am stuck at this one.
We're currently using the Office2019 theme in the Light color variation.
The problem I'm facing is with the selection of a TreeViewItem and the involved change of the Foreground color that goes along with it.
For TreeViewItems that use a string as a header this works just fine. The item i selected, the Background changes to blue and the Foreground to white. Perfetly readable.
However if I use a grid (containing a TextBlock) as the Header the foreground of the TextBlock remains black and does not change to white.
I tried binding the Foreground color of the TextBlock to the Foreground color of the parent TreeViewItem like so:
Binding binding =
new
Binding(
"Foreground"
);
binding.RelativeSource =
new
RelativeSource(RelativeSourceMode.FindAncestor,
typeof
(RadTreeViewItem), 1);
tb.SetBinding(TextBlock.ForegroundProperty, binding);
However this does not work. Possible because the Foreground property of the TreeViewItem is never changed, but only the Foreground property of the header:
<!-- IsSelected general setters -->
<
Trigger
Property
=
"IsSelected"
Value
=
"True"
>
<
Setter
TargetName
=
"Header"
Property
=
"Foreground"
Value
=
"{telerik1:Office2019Resource ResourceKey=CheckedForegroundBrush}"
/>
<
Setter
TargetName
=
"BorderVisual"
Property
=
"Background"
Value
=
"{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(helpers:ThemeHelper.CheckedBrush)}"
/>
</
Trigger
>
I tried to add another setter to this trigger and set the Foreground property of the TreeViewItem. This kind of works, but unfortunately propagates through all child items of a TreeViewItem.
Any suggestions on how my desired behaviour could be implemented?