or
<telerik:RadGridView
ItemsSource="{Binding Fields}"
x:Name="FieldGridView"
AutoGenerateColumns="False"
CanUserInsertRows="False"
CanUserDeleteRows="False"
CanUserReorderColumns="False"
CanUserResizeColumns="False"
CanUserSelect="True"
CanUserSortColumns="False"
ClipboardCopyMode="Cells"
ShowGroupPanel="False"
SelectionMode="Extended"
SelectionUnit="Cell"
RowIndicatorVisibility="Collapsed"
ColumnWidth="*"
GridLinesVisibility="Horizontal"
EnableColumnVirtualization="True"
RowDetailsVisibilityMode="Collapsed"
ShowColumnHeaders="False"
RowLoaded="FieldGridViewChild_RowLoaded"
>
<telerik:RadGridView.Background>
<SolidColorBrush/>
</telerik:RadGridView.Background>
<telerik:RadGridView.ChildTableDefinitions>
<telerik:GridViewTableDefinition />
</telerik:RadGridView.ChildTableDefinitions>
<telerik:RadGridView.HierarchyChildTemplate>
<DataTemplate>
<telerik:RadGridView
ItemsSource="{Binding Fields}"
x:Name="FieldGridViewChild"
AutoGenerateColumns="False"
CanUserInsertRows="False"
CanUserDeleteRows="False"
CanUserReorderColumns="False"
CanUserResizeColumns="False"
CanUserSelect="True"
CanUserSortColumns="False"
ClipboardCopyMode="Cells"
ShowGroupPanel="False"
SelectionMode= "Extended"
SelectionUnit="Cell"
RowIndicatorVisibility="Collapsed"
ColumnWidth="*"
GridLinesVisibility="Horizontal"
EnableColumnVirtualization="True"
ShowColumnHeaders="False"
>
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn
Header="Id"
DataMemberBinding="{Binding ID}"
DataFormatString=""
Width="40"
IsReadOnly="True"
Background="#E5E5E5"
TextAlignment="Right" />
<telerik:GridViewDataColumn
Width="*"
TextWrapping="Wrap"
DataMemberBinding="{Binding Value}" />
</telerik:RadGridView.Columns>
</telerik:RadGridView>
</DataTemplate>
</telerik:RadGridView.HierarchyChildTemplate>
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn
Header="Id"
DataMemberBinding="{Binding ID}"
DataFormatString=""
Width="41" TextAlignment="Right"
IsReadOnly="True"
Background="LightGray" />
<telerik:GridViewDataColumn
Width="*"
TextTrimming="None"
TextWrapping="Wrap"
DataMemberBinding="{Binding Value}" />
</telerik:RadGridView.Columns>
</telerik:RadGridView>
<
telerik:RadGauge
Name
=
"myGauge"
Style
=
"{StaticResource gaugeRadGaugeStyle}"
>
<
telerik:RadialGauge
>
<
telerik:RadialScale
Name
=
"radialScale"
Min
=
"-180"
Max
=
"180"
SweepAngle
=
"360"
StartAngle
=
"90"
>
<
telerik:RadialScale.Label
>
<
telerik:LabelProperties
Foreground
=
"Transparent"
/>
</
telerik:RadialScale.Label
>
<
telerik:RadialScale.Ticks
>
<
telerik:TickProperties
Foreground
=
"Transparent"
/>
<!--<telerik:MinorTickProperties Foreground="Transparent" />-->
</
telerik:RadialScale.Ticks
>
<
telerik:RangeList
>
<
telerik:RadialRange
Name
=
"SynchroscopeRange"
Style
=
"{StaticResource gaugeRadialRangeStyle}"
/>
</
telerik:RangeList
>
<
telerik:IndicatorList
>
<
telerik:Needle
Name
=
"needle"
IsAnimated
=
"true"
Value
=
"{Binding Value}"
/>
</
telerik:IndicatorList
>
</
telerik:RadialScale
>
</
telerik:RadialGauge
>
</
telerik:RadGauge
>
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
Pages
xmlns
=
""
>
<
page
name
=
"Name 1"
UriSource
=
"Pages/Name1.xaml"
/>
<
page
name
=
"Name 2"
UriSource
=
"Pages/Name2.xaml"
>
<
level2
name
=
"ALL1"
UriSource
=
"Pages/All1.xaml"
/>
<
level2
name
=
"ALL2"
UriSource
=
"Pages/All2.xaml"
/>
<
level2
name
=
"ALL3"
UriSource
=
"Pages/All3.xaml"
/>
</
page
>
<
page
name
=
"Name 3"
UriSource
=
"Pages/Name3.xaml"
/>
<
level2
name
=
"ALL1"
UriSource
=
"Pages/All1.xaml"
>
<
level3
name
=
"ALL3_1"
UriSource
=
""
/>
<
level3
name
=
"ALL3_2"
UriSource
=
""
/>
<
level3
name
=
"ALL3_3"
UriSource
=
""
/>
</
level2
>
<
level2
name
=
"ALL2"
UriSource
=
"Pages/All2.xaml"
/>
<
level2
name
=
"ALL3"
UriSource
=
"Pages/All3.xaml"
/>
</
page
>
<
page
name
=
"Name 4"
UriSource
=
"Pages/Name4.xaml"
/>
</
Pages
>
<
Window
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
xmlns:telerikQuickStart
=
"clr-namespace:Telerik.Windows.Controls.QuickStart;assembly=Telerik.Windows.Controls"
x:Class
=
"NavPane_2.MainWindow"
x:Name
=
"Window"
Title
=
"MainWindow"
Width
=
"640"
Height
=
"480"
>
<
Window.Resources
>
<
XmlDataProvider
x:Key
=
"PageData"
Source
=
"Data/data.xml"
XPath
=
"/Pages"
/>
<
HierarchicalDataTemplate
x:Key
=
"page"
ItemsSource
=
"{Binding XPath=page}"
ItemTemplate
=
"{StaticResource level2}"
>
<
TextBlock
Text
=
"{Binding XPath=@name}"
/>
</
HierarchicalDataTemplate
>
<
HierarchicalDataTemplate
x:Key
=
"level2"
ItemsSource
=
"{Binding XPath=page/level2}"
ItemTemplate
=
"{StaticResource level3}"
>
<
TextBlock
Text
=
"{Binding XPath=@name}"
/>
</
HierarchicalDataTemplate
>
<
DataTemplate
x:Key
=
"level3"
ItemsSource
=
"{Binding XPath=page/level2/level3}"
>
<
TextBlock
Text
=
"{Binding XPath=@name}"
/>
</
DataTemplate
>
</
Window.Resources
>
<
Grid
x:Name
=
"LayoutRoot"
>
<
telerikQuickStart:HeaderedContentControl
HorizontalAlignment
=
"Center"
VerticalAlignment
=
"Center"
Header
=
"Sample"
telerikQuickStart:ThemeAwareBackgroundBehavior.IsEnabled
=
"True"
HorizontalContentAlignment
=
"Stretch"
VerticalContentAlignment
=
"Stretch"
Width
=
"250"
Height
=
"350"
>
<
telerik:RadTreeView
HorizontalAlignment
=
"Left"
Margin
=
"8"
Background
=
"#FFF9F9F9"
IsDragDropEnabled
=
"True"
SelectionMode
=
"Multiple"
IsSingleExpandPath
=
"True"
telerik:StyleManager.Theme
=
"Vista"
ItemTemplate
=
"{StaticResource page}"
ItemsSource
=
"{Binding Source={StaticResource PageData}, XPath=page}"
>
</
telerik:RadTreeView
>
</
telerikQuickStart:HeaderedContentControl
>
</
Grid
>
</
Window
>
<
Window
x:Class
=
"DragandDrop.Window1"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
xmlns:telerikQuickStart
=
"clr-namespace:Telerik.Windows.Controls.QuickStart;assembly=Telerik.Windows.Controls"
Title
=
"Window1"
Height
=
"300"
Width
=
"300"
>
<
Window.Resources
>
<
DataTemplate
x:Key
=
"ApplicationDragTemplate"
>
<
Grid
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"50"
/>
<
RowDefinition
Height
=
"50"
/>
</
Grid.RowDefinitions
>
<
TextBlock
Text
=
"{Binding Name}"
Grid.Row
=
"0"
VerticalAlignment
=
"Top"
/>
<
TextBlock
Text
=
"{Binding Author}"
Grid.Row
=
"1"
VerticalAlignment
=
"Top"
/>
<!--<
telerik:RadGridView
x:Name
=
"Info"
Grid.Row
=
"0"
RowIndicatorVisibility
=
"Collapsed"
IsReadOnly
=
"True"
ItemsSource
=
"{Binding Path=ApplicationInfo}"
ShowGroupPanel
=
"False"
AutoGenerateColumns
=
"False"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Name}"
Width
=
"110"
HeaderTextAlignment
=
"Center"
TextAlignment
=
"Left"
Header
=
"Name"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Author}"
Width
=
"80"
HeaderTextAlignment
=
"Center"
TextAlignment
=
"Right"
Header
=
"Author"
/>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>-->
</
Grid
>
</
DataTemplate
>
<
Style
TargetType
=
"ListBoxItem"
x:Key
=
"draggableItemStyle"
>
<
Setter
Property
=
"HorizontalAlignment"
Value
=
"Stretch"
/>
<
Setter
Property
=
"HorizontalContentAlignment"
Value
=
"Stretch"
/>
<
Setter
Property
=
"Foreground"
Value
=
"#000000"
/>
<
Setter
Property
=
"telerik:RadDragAndDropManager.AllowDrag"
Value
=
"True"
/>
</
Style
>
</
Window.Resources
>
<
Grid
x:Name
=
"LayoutRoot"
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"200"
/>
<
ColumnDefinition
Width
=
"150"
/>
<
ColumnDefinition
Width
=
"*"
/>
</
Grid.ColumnDefinitions
>
<!--All Applications-->
<
telerikQuickStart:HeaderedContentControl
Header
=
"All Applications"
HorizontalContentAlignment
=
"Stretch"
VerticalContentAlignment
=
"Stretch"
>
<
ListBox
x:Name
=
"allApplicationsBox"
Margin
=
"3"
BorderThickness
=
"0"
telerik:RadDragAndDropManager.AllowDrop
=
"True"
Background
=
"Transparent"
ItemContainerStyle
=
"{StaticResource draggableItemStyle}"
>
<
ListBox.ItemTemplate
>
<
DataTemplate
>
<
Grid
Width
=
"150"
>
<
Grid.RowDefinitions
>
<
RowDefinition
/>
<
RowDefinition
/>
<
RowDefinition
/>
</
Grid.RowDefinitions
>
<
TextBlock
Grid.Row
=
"1"
Text
=
"{Binding Name}"
FontWeight
=
"Bold"
HorizontalAlignment
=
"Center"
/>
<!--<
TextBlock
Text
=
"{Binding Author}"
Grid.Row
=
"2"
HorizontalAlignment
=
"Center"
/>-->
</
Grid
>
</
DataTemplate
>
</
ListBox.ItemTemplate
>
</
ListBox
>
</
telerikQuickStart:HeaderedContentControl
>
<!--Text-->
<
Border
Grid.Column
=
"1"
Background
=
"#1f2759"
CornerRadius
=
"5"
VerticalAlignment
=
"Center"
HorizontalAlignment
=
"Center"
>
</
Border
>
<!--My Applications-->
<
telerikQuickStart:HeaderedContentControl
Header
=
"My Applications"
HorizontalContentAlignment
=
"Stretch"
VerticalContentAlignment
=
"Stretch"
Grid.Column
=
"2"
>
<
ListBox
x:Name
=
"myApplicationsBox"
Margin
=
"3"
Background
=
"Transparent"
telerik:RadDragAndDropManager.AllowDrop
=
"True"
BorderThickness
=
"0"
ItemContainerStyle
=
"{StaticResource draggableItemStyle}"
>
<
ListBox.ItemTemplate
>
<
DataTemplate
>
<
StackPanel
VerticalAlignment
=
"Stretch"
HorizontalAlignment
=
"Stretch"
>
<
Grid
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"40"
/>
<
RowDefinition
Height
=
"*"
/>
</
Grid.RowDefinitions
>
<
TextBlock
Grid.Row
=
"0"
Text
=
"{Binding Name}"
HorizontalAlignment
=
"Center"
/>
<!--<TextBlock Text="{Binding Author}" HorizontalAlignment="Center" />-->
<
telerik:RadGridView
x:Name
=
"View"
Grid.Row
=
"1"
AllowDrop
=
"True"
RowIndicatorVisibility
=
"Collapsed"
IsReadOnly
=
"True"
ItemsSource
=
"{Binding Path=allApplications}"
ShowGroupPanel
=
"False"
AutoGenerateColumns
=
"False"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Name}"
Width
=
"110"
HeaderTextAlignment
=
"Center"
TextAlignment
=
"Left"
Header
=
"Name"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Author}"
Width
=
"80"
HeaderTextAlignment
=
"Center"
TextAlignment
=
"Right"
Header
=
"Author"
/>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
</
Grid
>
</
StackPanel
>
</
DataTemplate
>
</
ListBox.ItemTemplate
>
<
ListBox.ItemsPanel
>
<
ItemsPanelTemplate
>
<
telerik:RadUniformGrid
Columns
=
"3"
HorizontalAlignment
=
"Left"
VerticalAlignment
=
"Top"
/>
</
ItemsPanelTemplate
>
</
ListBox.ItemsPanel
>
</
ListBox
>
</
telerikQuickStart:HeaderedContentControl
>
</
Grid
>
</
Window
>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Collections.ObjectModel;
using Telerik.Windows.Controls.DragDrop;
namespace DragandDrop
{
/// <
summary
>
/// Interaction logic for Window1.xaml
/// </
summary
>
public partial class Window1 : Window
{
public static ObservableCollection<
ApplicationInfo
> GenerateApplicationInfos()
{
ObservableCollection<
ApplicationInfo
> result = new ObservableCollection<
ApplicationInfo
>();
ApplicationInfo info1 = new ApplicationInfo();
info1.Name = "James Collider";
info1.Author = "Rockford";
result.Add(info1);
ApplicationInfo info2 = new ApplicationInfo();
info2.Name = "Alentra";
info2.Author = "Google.";
result.Add(info2);
ApplicationInfo info3 = new ApplicationInfo();
info3.Name = "Thomas COOK";
info3.Author = "Yahoo";
result.Add(info3);
ApplicationInfo info4 = new ApplicationInfo();
info4.Name = "Britsh Airways";
info4.Author = "Google";
ApplicationInfo info5 = new ApplicationInfo();
info5.Name = "Trader Joe";
info5.Author = "Factory";
ApplicationInfo info6 = new ApplicationInfo();
info6.Name = "IE Fox";
info6.Author = "Open Org";
result.Add(info6);
ApplicationInfo info7 = new ApplicationInfo();
info7.Name = "Charting";
info7.Author = "PieChart";
result.Add(info7);
ApplicationInfo info8 = new ApplicationInfo();
info8.Name = "Batman";
info8.Author = "Games";
result.Add(info8);
return result;
}
ObservableCollection<
ApplicationInfo
> allApplications = GenerateApplicationInfos();
ObservableCollection<
ApplicationInfo
> myApplications;
Brush listBoxDragPossible = new SolidColorBrush(Colors.Orange);
public Window1()
{
InitializeComponent();
myApplications = new ObservableCollection<
ApplicationInfo
>();
allApplicationsBox.ItemsSource = allApplications;
myApplicationsBox.ItemsSource = myApplications;
RadDragAndDropManager.AddDragQueryHandler(this, OnDragQuery);
RadDragAndDropManager.AddDragInfoHandler(this, OnDragInfo);
RadDragAndDropManager.AddDropQueryHandler(this, OnDropQuery);
RadDragAndDropManager.AddDropInfoHandler(this, OnDropInfo);
}
private void OnDropInfo(object sender, DragDropEventArgs e)
{
ItemsControl box = e.Options.Destination as ItemsControl;
if (box == null) return;
IList<
ApplicationInfo
> itemsSource = box.ItemsSource as IList<
ApplicationInfo
>;
ApplicationInfo payload = e.Options.Payload as ApplicationInfo;
if (e.Options.Status == DragStatus.DropPossible)
{
box.BorderBrush = listBoxDragPossible;
}
else
{
box.BorderBrush = new SolidColorBrush(Colors.Gray);
}
if (e.Options.Status == DragStatus.DropComplete)
{
if (!itemsSource.Contains(payload))
{
itemsSource.Add(payload);
}
}
}
void OnDropQuery(object sender, DragDropQueryEventArgs e)
{
ItemsControl box = e.Options.Destination as ItemsControl;
if (box == null) return;
IList<
ApplicationInfo
> itemsSource = box.ItemsSource as IList<
ApplicationInfo
>;
ApplicationInfo payload = e.Options.Payload as ApplicationInfo;
e.QueryResult = payload != null && !itemsSource.Contains(payload);
}
void OnDragInfo(object sender, DragDropEventArgs e)
{
try
{
ListBoxItem listBoxItem = e.Options.Source as ListBoxItem;
ListBox box = ItemsControl.ItemsControlFromItemContainer(listBoxItem) as ListBox;
IList<
ApplicationInfo
> itemsSource = box.ItemsSource as IList<
ApplicationInfo
>;
ApplicationInfo payload = e.Options.Payload as ApplicationInfo;
if (e.Options.Status == DragStatus.DragComplete)
{
if (payload != null && itemsSource.Contains(payload))
{
itemsSource.Remove(payload);
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
protected virtual void OnDragQuery(object sender, DragDropQueryEventArgs e)
{
ListBoxItem listBoxItem = e.Options.Source as ListBoxItem;
ListBox box = ItemsControl.ItemsControlFromItemContainer(listBoxItem) as ListBox;
if (e.Options.Status == DragStatus.DragQuery && box != null)
{
e.Options.Payload = box.SelectedItem;
ContentControl cue = new ContentControl();
cue.ContentTemplate = this.Resources["ApplicationDragTemplate"] as DataTemplate;
cue.Content = box.SelectedItem;
e.Options.DragCue = cue;
e.Options.ArrowCue = RadDragAndDropManager.GenerateArrowCue();
}
e.QueryResult = true;
}
}
public class ApplicationInfo
{
// private Double _price;
private String _name;
private String _author;
public String Name
{
get { return this._name; }
set { this._name = value; }
}
public String Author
{
get { return this._author; }
set { this._author = value; }
}
}
}