I am trying to use TreeControl and getting this error from VS 2008.
(Warning)The property 'HeaderTemplate' does not exist on the type 'HierarchicalDataTemplate' in the XML namespace 'clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls'.
(Error)The property 'HeaderTemplate' was not found in type 'HierarchicalDataTemplate'.
This is sample xaml that I am trying...
<UserControl x:Class="RadTreeViewWithWCF.Page" |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation" |
xmlns:core="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls" |
xmlns:local="clr-namespace:RadTreeViewWithWCF" |
Width="700" Height="500"> |
<UserControl.Resources> |
<local:HierarchicalDataSource x:Key="Source" /> |
<core:HierarchicalDataTemplate x:Key="NodeTemplate" ItemsSource="{Binding Children}"> |
<core:HierarchicalDataTemplate.HeaderTemplate> |
<DataTemplate> |
<TextBlock Text="{Binding NodeText}" TextWrapping="Wrap" Width="400"/> |
</DataTemplate> |
</core:HierarchicalDataTemplate.HeaderTemplate> |
</core:HierarchicalDataTemplate> |
</UserControl.Resources> |
<Grid> |
<telerik:RadTreeView |
HorizontalAlignment="Left" |
VerticalAlignment="Top" |
ItemsSource="{Binding Source={StaticResource Source}}" |
ItemTemplate="{StaticResource NodeTemplate}" |
/> |
</Grid> |
</UserControl> |
I appreciate in advance for any suggestions.
Thank you
10 Answers, 1 is accepted
And I am getting... (Error)The member "HeaderTemplate" is not recognized or is not accessible." - Line 16.
Thanks
I suppose you are using this example:
http://blogs.telerik.com/kirilstanoev/posts/08-08-27/Populating_Silverlight_TreeView_from_WCF_Service_with_LINQ_to_SQL.aspx
I get different error from VS 2008 as the following.
(Error) AG_E_UNKNOWN_ERROR [Line: 18 Position: 39]
C:\downloads\132090_radtreeviewwithwcf\RadTreeViewWithWCF\RadTreeViewWithWCF\Page.xaml 10 31 RadTreeViewWithWCF
However the sample app runs fine.
Thank you.
var rootNodes = this.unsortedList.Where(x => x.ParentID == x.NodeID);
Error 3 'System.Collections.Generic.List<ClaimsRecovery_SL.TableItem>' does not contain a definition for 'Where' and no extension method 'Where' accepting a first argument of type 'System.Collections.Generic.List<ClaimsRecovery_SL.TableItem>' could be found (are you missing a using directive or an assembly reference?) C:\OLD PC\Web\ClaimsRecovery_SL\ClaimsRecovery_SL\ClaimsRecovery_SL\Views\Admin\HierarchicalDataSource.cs 42 47 ClaimsRecovery_SL
I am not using LINQ.
public
HierarchicalDataSource()
{
// Create a new instance of the web service and get the data from the table
AdminManagerClient menuAdmin = new AdminManagerClient();
menuAdmin.GetParentInfoCompleted +=
new EventHandler<GetParentInfoCompletedEventArgs>(menuAdmin_GetParentInfoCompleted);
menuAdmin.GetParentInfoAsync();
}
private void menuAdmin_GetParentInfoCompleted(object sender, GetParentInfoCompletedEventArgs e)
{
// transfer all the items from the result to the unsorted list
foreach (ParentMenuItem item in e.Result)
{
TableItem genericItem = new TableItem(item.Text, item.ItemID, item.ParentID);
this.unsortedList.Add(genericItem);
}
You have to add the following using directive :
using System.Linq;
Take a look at the following msdn article:
http://msdn.microsoft.com/en-us/library/bb910018.aspx
Best wishes,
Boryana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Thanks for the reply. code is working now.
I have added checkbox in tree using following property and while loading the tree all the checkbox that are previously selected should be selected.
ItemsOptionListType="CheckList" IsOptionElementsEnabled="True"
I have create container binding
<telerik:ContainerBinding PropertyName="CheckState" Binding="{Binding IsChecked, Converter={StaticResource CheckStateConverter}}"/>
<telerik:HierarchicalDataTemplate x:Key="NodeTemplate"
ItemsSource="{Binding Children}"
telerik:ContainerBinding.ContainerBindings="{StaticResource BindingsCollection}">
<TextBlock Text="{Binding NodeText}" TextWrapping="Wrap" Width="400"/>
</telerik:HierarchicalDataTemplate>
And in source I created property
public bool IsChecked
{
get
{
return this.isChecked;
}
set
{
if (this.isChecked != value)
{
this.isChecked = value;
NotifyPropertyChanged("IsChecked");
}
}
}
When this run NotifyPropertyChanged coming as null.
And class
public class CheckStateConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
bool result = (bool)value;
return result ? ToggleState.On : ToggleState.Off;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
ToggleState state = (ToggleState)value;
return state == ToggleState.On ? true : false;
}
}
Still not checking the check box at time of loading. Am I missing something?
Your code appears to be correct.
There is a bug for ContainerBindings and the CheckState property. We are working on it and it should be resolved soon. It may be part of this week's internal build. Certainly it will be resolved for the coming release.
Greetings,
Miroslav
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Sorry to open this thread after so long.
Has this been fixed? Since I'm trying to use the same and I get the PropertyChanged as null. Not sure if it is a problem in my code or the issue still persists.
Thanks & Regards
Senthil
Yes, the bug has been fixed. I prepared a sample project illustrating such scenario that uses the latest versions of our controls. Please take a look at it and tell me if it helps.
Feel free to ask if you need further assistance.
Petar Mladenov
the Telerik team