How do to set up the TreeListView

5 posts, 0 answers
  1. JungTae
    JungTae avatar
    54 posts
    Member since:
    Sep 2010

    Posted 21 Oct 2010 Link to this post

    Hello Telerik community, I want to try the RadTreeListView out for my project, but i'm stuck... My xaml page is unable to find the radtreelistview option. I am using VSTS 2008 SP 1 with .NET 3.5  with Silverlight 3

    this is my XAML page code and the error is on

    <telerikDataView:RadTreeListView x:Name="protoTreeListView">

    where the error message is

    Error 1 The type 'telerikDataView:RadTreeListView' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built. C:\Documents and Settings\kimj2\My Documents\Visual Studio 2008\Projects\TreeListViewPrototype\TreeListViewPrototype\MainPage.xaml 13 10 TreeListViewPrototype

    I also get the same error when i Copy and Paste this from "Getting Started" page

    <telerik:RadTreeListView x:Name="radTreeListView">
    </
    telerik:RadTreeListView


    <UserControl x:Class="TreeListViewPrototype.MainPage"
        xmlns:telerikControls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
        xmlns:telerikDataView="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
        xmlns:telerikInput="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Input"  
                   
        mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480"
        >
      <Grid x:Name="LayoutRoot">
      
            <telerikDataView:RadTreeListView x:Name="protoTreeListView">
                  
            </telerikDataView:RadTreeListView>
      
        </Grid>
    </UserControl>
  2. JungTae
    JungTae avatar
    54 posts
    Member since:
    Sep 2010

    Posted 21 Oct 2010 Link to this post

    Ok so I got it to set up, but now I can't figure out how to setup the ChldTables
  3. DevCraft banner
  4. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 22 Oct 2010 Link to this post

    Hello,

     Have you checked our demos?

    Regards,
    Vlad
    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
  5. JungTae
    JungTae avatar
    54 posts
    Member since:
    Sep 2010

    Posted 22 Oct 2010 Link to this post

    That is only for Silverlight 4 though, I need the support for Silverlight 3. Do you guys still have a documentation for Silverlight 3 controls?
  6. JungTae
    JungTae avatar
    54 posts
    Member since:
    Sep 2010

    Posted 22 Oct 2010 Link to this post

    I thought I'd provide you guys with my c# source code for my sample data just to make it easier for you 
    Don't worry about the .Web project since i haven't implemented anything yet.
    I can get the first level of data to appear, but not the second level for some reason

    <UserControl x:Class="TreeListViewPrototype.MainPage"
        xmlns:telerikControls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
        xmlns:telerikDataView="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
        xmlns:telerikInput="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Input"  
        xmlns:telerikNavigation="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation"
        xmlns:local="clr-namespace:TreeListViewPrototype"
        mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480" >
      
        <UserControl.Resources>
                  
            <local:HierarchyConverter x:Key="HierarchyConverter" />    
              
            <telerikControls:HierarchicalDataTemplate x:Key="RootItem" 
                    ItemsSource="{Binding Converter={StaticResource HierarchyConverter}}" >
                <TextBlock Text="{Binding Name}" />
            </telerikControls:HierarchicalDataTemplate>
              
            <DataTemplate x:Key="DataTemplate1">
                <Grid>
                    <TextBlock Text="{Binding Name,Mode=OneWay}" TextWrapping="Wrap" />
                </Grid>
            </DataTemplate>
      
      
        </UserControl.Resources>
        <Grid x:Name="LayoutRoot" >
      
                <telerikNavigation:RadTreeListView x:Name="protoTreeListView" 
                                               SelectionMode="Extended"
                                               ItemTemplate="{StaticResource RootItem}"
                                               ItemsSource="{Binding Converter={StaticResource HierarchyConverter}}"
                                                   SelectedValuePath="Name" SelectionChanged="protoTreeListView_SelectionChanged">
         
                <telerikNavigation:RadTreeListView.Columns>
                    <telerikNavigation:RadColumn x:Name="name" Header="Bond Name" CellTemplate="{StaticResource DataTemplate1}"  />                   
                                               
                </telerikNavigation:RadTreeListView.Columns>
            </telerikNavigation:RadTreeListView>
      
        </Grid>
    </UserControl>



    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.Collections.ObjectModel;

     

    using

     

    Telerik.Windows.Controls;

     

    using

     

    System.ComponentModel;

     

    using

     

    System.Windows.Data;

     

    using

     

    System.Globalization;

     

    using

     

    Telerik.Windows.Data;

     

    namespace

     

    TreeListViewPrototype

     

    {

     

    public partial class MainPage : UserControl

     

    {

     

    public MainPage()

     

    {

     

     

    ObservableCollection<Bond> data = new ObservableCollection<Bond>();

     

     

     

    Bond bond1 = new Bond("FirstBond");

     

     

    Bond bond2 = new Bond("SecondBond");

     

     

    bond1.history.Add(

    new History(1.00, "Joe"));

     

    bond1.history.Add(

    new History(2.00, "Bob"));

     

    bond1.history.Add(

    new History(3.00, "Mary"));

     

    bond1.history.Add(

    new History(4.00, "Alex"));

     

    bond2.history.Add(

    new History(10.00, "Caleb"));

     

    bond2.history.Add(

    new History(20.00, "Kamilla"));

     

    bond2.history.Add(

    new History(30.00, "Justin"));

     

    bond2.history.Add(

    new History(40.00, "Mike"));

     

    InitializeComponent();

    data.Add(bond1);

    data.Add(bond2);

     

    this.protoTreeListView.ItemsSource = data;

     

    }

     

    private void protoTreeListView_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangedEventArgs e)

     

    {

     

    string something;

     

    something = sender.GetType().ToString();

    }

    }

     

    public class Bond : INotifyPropertyChanged

     

    {

     

    public event PropertyChangedEventHandler PropertyChanged;

     

     

    private string name;

     

     

    public string Name

     

    {

     

    get

     

    {

     

    return this.name;

     

    }

     

    set

     

    {

     

    if (this.name != value)

     

    {

     

    this.name = value;

     

     

    this.OnPropertyChanged("Name");

     

    }

    }

    }

     

    public Bond(string name)

     

    {

     

    this.Name = name;

     

     

    this.history = new ObservableCollection<History>();

     

    }

     

    public ObservableCollection<History> history

     

    {

     

    get;

     

     

    set;

     

    }

     

    protected void OnPropertyChanged(string propertyName)

     

    {

     

    if (this.PropertyChanged != null)

     

    {

     

    this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));

     

    }

    }

     

    }

     

    public class History : INotifyPropertyChanged

     

    {

     

    public double Price { get; set; }

     

     

    public string Buyer { get; set; }

     

     

    public event PropertyChangedEventHandler PropertyChanged;

     

     

    public History(double price, string buyer)

     

    {

     

    this.Price = price;

     

     

    this.Buyer = buyer;

     

    }

     

    protected void OnPropertyChanged(string propertyName)

     

    {

     

    if (this.PropertyChanged != null)

     

    {

     

    this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));

     

    }

    }

    }

     

     

    public class HierarchyConverter : IValueConverter

     

    {

     

    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)

     

    {

     

    // We are binding an item

     

     

    Bond item = value as Bond;

     

     

    if (item != null)

     

    {

     

    return item.history.Where(x => x != null);

     

    }

     

    // We are binding the treeview

     

     

    ObservableCollection<Bond> items = value as ObservableCollection<Bond>;

     

     

    if (items != null)

     

    {

     

    return items.Where(x=> x.Name == "FirstBond");

     

    }

     

    return null;

     

    }

     

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)

     

    {

     

    throw new NotImplementedException();

     

    }

    }

    }

Back to Top
DevCraft banner