Hello. I get the following error when trying to load items dynamically into a RadTreeView that's in a RadDropDownButton on a RadWindow.
"Error HRESULT E_FAIL has been returned from a call to a COM component."
If the tree is not on a window it works fine. Or, if the tree is not in the RadDropDownButton it also works fine.
Can you give me a workaround?
Thanks
Here's my code.
//C#
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Net;
using
System.Windows;
using
System.Windows.Controls;
using
System.Windows.Documents;
using
System.Windows.Input;
using
System.Windows.Media;
using
System.Windows.Media.Animation;
using
System.Windows.Shapes;
using
System.Windows.Navigation;
using
Telerik.Windows.Controls;
namespace
WindowTest2
{
public partial class MainPage : Page
{
public MainPage()
{
InitializeComponent();
btn.Click +=
new RoutedEventHandler(btn_Click);
RadTreeViewItem radTreeViewItem = new RadTreeViewItem();
radTreeViewItem.Header =
"All";
tvLocations.Items.Add(radTreeViewItem);
tvLocations.SelectedItem = radTreeViewItem;
}
void btn_Click(object sender, RoutedEventArgs e)
{
rwdFilters.ShowDialog();
}
}
}
//XAML
<navigation:Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls" xmlns:telerikNavigation="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation" x:Class="WindowTest2.MainPage"
d:DesignWidth="640" d:DesignHeight="480"
Title="MainPage Page">
<Grid x:Name="LayoutRoot">
<telerikNavigation:RadWindow x:Name="rwdFilters" HorizontalAlignment="Right" Margin="0,0,0,0" VerticalAlignment="Top" Width="461" Height="384">
<Canvas Width="450" Height="320">
<telerik:RadDropDownButton x:Name="rddTree" Padding="0" DropDownWidth="215" DropDownHeight="300" Content="All" Width="200" HorizontalAlignment="Left" Height="20" VerticalAlignment="Top" Canvas.Left="140" Canvas.Top="120">
<telerik:RadDropDownButton.DropDownContent>
<telerikNavigation:RadTreeView x:Name="tvLocations" Height="299" Margin="0,0,0,0" VerticalAlignment="Bottom"/>
</telerik:RadDropDownButton.DropDownContent>
</telerik:RadDropDownButton>
</Canvas>
</telerikNavigation:RadWindow>
<telerik:RadButton x:Name="btn" Height="51" HorizontalAlignment="Left" Margin="33,23,0,0" VerticalAlignment="Top" Width="127" Content="Button"/>
</Grid>
</navigation:Page>