Hello! I would like to know how to remove a second line in RadTreeLIstView, with the text "PersonName". I would like to appear just First and Last Name when click in RadTreeLIstView. I created a RadTreeListView with 2 columns and a NamedLIst() class.
Another question is: I inserted IsEditable="True", but I canĀ“t edit, why ?
See my example and attached image:
-----------------------------------------MainPage.xaml ----------------------------
<UserControl x:Class="SilverlightApplication1.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:SilverlightApplication1"
xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
xmlns:nav="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation"
mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Height="213" Width="469" xmlns:my="clr-namespace:Telerik.Windows.Controls.TreeView;assembly=Telerik.Windows.Controls.Navigation">
<nav:RadTreeListView Background="White" x:Name="RadTreeListViewTest" BorderBrush="#a9a9a9" BorderThickness="1" HorizontalContentAlignment="Center" Width="415" Height="170"
IsDragDropEnabled="False" IsDragPreviewEnabled="False" IsDragTooltipEnabled="False"
SelectionMode="Single"
IsSingleExpandPath="False"
IsExpandOnSingleClickEnabled="True"
IsLineEnabled="True" IsEditable="True">
<nav:RadTreeListView.Columns>
<nav:RadColumn Header="First Name" PropertyName="FirstName" Width="150" IsEditable="True" >
<nav:RadColumn.CellTemplate>
<DataTemplate>
<TextBlock Foreground="#284869" Text="{Binding FirstName}" VerticalAlignment="Center" />
</DataTemplate>
</nav:RadColumn.CellTemplate>
</nav:RadColumn>
<nav:RadColumn Header="Last Name" PropertyName="LastName" Width="150" IsEditable="True">
<nav:RadColumn.CellTemplate>
<DataTemplate>
<TextBlock Foreground="#284869" Text="{Binding LastName}" VerticalAlignment="Center" />
</DataTemplate>
</nav:RadColumn.CellTemplate>
</nav:RadColumn>
</nav:RadTreeListView.Columns>
</nav:RadTreeListView>
</UserControl>
----------------------------------MainPage.xaml.cs-------------------------------
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;
using System.Collections.ObjectModel;
namespace SilverlightApplication1
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
//Add only Folders, after click add parents...
IList itemsSource = new ObservableCollection<object>();
itemsSource = new NameList();
this.RadTreeListViewTest.ItemsSource = itemsSource;
}
}
}
------------------------------NamedList() class--------------------------
using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.ObjectModel;
public class NameList : ObservableCollection<PersonName>
{
public NameList(): base()
{
Add(new PersonName("XX", "11"));
Add(new PersonName("WW", "22"));
Add(new PersonName("AA", "33"));
Add(new PersonName("QQ", "44"));
Add(new PersonName("RR", "55"));
}
}
public class PersonName
{
private string firstName;
private string lastName;
public PersonName(string first, string last)
{
this.firstName = first;
this.lastName = last;
}
public string FirstName
{
get { return firstName; }
set { firstName = value; }
}
public string LastName
{
get { return lastName; }
set { lastName = value; }
}
}
Another question is: I inserted IsEditable="True", but I canĀ“t edit, why ?
See my example and attached image:
-----------------------------------------MainPage.xaml ----------------------------
<UserControl x:Class="SilverlightApplication1.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:SilverlightApplication1"
xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
xmlns:nav="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation"
mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Height="213" Width="469" xmlns:my="clr-namespace:Telerik.Windows.Controls.TreeView;assembly=Telerik.Windows.Controls.Navigation">
<nav:RadTreeListView Background="White" x:Name="RadTreeListViewTest" BorderBrush="#a9a9a9" BorderThickness="1" HorizontalContentAlignment="Center" Width="415" Height="170"
IsDragDropEnabled="False" IsDragPreviewEnabled="False" IsDragTooltipEnabled="False"
SelectionMode="Single"
IsSingleExpandPath="False"
IsExpandOnSingleClickEnabled="True"
IsLineEnabled="True" IsEditable="True">
<nav:RadTreeListView.Columns>
<nav:RadColumn Header="First Name" PropertyName="FirstName" Width="150" IsEditable="True" >
<nav:RadColumn.CellTemplate>
<DataTemplate>
<TextBlock Foreground="#284869" Text="{Binding FirstName}" VerticalAlignment="Center" />
</DataTemplate>
</nav:RadColumn.CellTemplate>
</nav:RadColumn>
<nav:RadColumn Header="Last Name" PropertyName="LastName" Width="150" IsEditable="True">
<nav:RadColumn.CellTemplate>
<DataTemplate>
<TextBlock Foreground="#284869" Text="{Binding LastName}" VerticalAlignment="Center" />
</DataTemplate>
</nav:RadColumn.CellTemplate>
</nav:RadColumn>
</nav:RadTreeListView.Columns>
</nav:RadTreeListView>
</UserControl>
----------------------------------MainPage.xaml.cs-------------------------------
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;
using System.Collections.ObjectModel;
namespace SilverlightApplication1
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
//Add only Folders, after click add parents...
IList itemsSource = new ObservableCollection<object>();
itemsSource = new NameList();
this.RadTreeListViewTest.ItemsSource = itemsSource;
}
}
}
------------------------------NamedList() class--------------------------
using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.ObjectModel;
public class NameList : ObservableCollection<PersonName>
{
public NameList(): base()
{
Add(new PersonName("XX", "11"));
Add(new PersonName("WW", "22"));
Add(new PersonName("AA", "33"));
Add(new PersonName("QQ", "44"));
Add(new PersonName("RR", "55"));
}
}
public class PersonName
{
private string firstName;
private string lastName;
public PersonName(string first, string last)
{
this.firstName = first;
this.lastName = last;
}
public string FirstName
{
get { return firstName; }
set { firstName = value; }
}
public string LastName
{
get { return lastName; }
set { lastName = value; }
}
}