This question is locked. New answers and comments are not allowed.
when i use silverlight 4,the dragcue works well
now i upgrade to silverlight 5 , it displays abnormally
i create a test project ,and the code as follows
now i upgrade to silverlight 5 , it displays abnormally
i create a test project ,and the code as follows
<
UserControl
x:Class
=
"RadControlsSilverlightApp1.MainPage"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
mc:Ignorable
=
"d"
d:DesignWidth
=
"640"
d:DesignHeight
=
"480"
>
<
Grid
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
/>
<
ColumnDefinition
Width
=
"2*"
/>
</
Grid.ColumnDefinitions
>
<
telerik:RadTreeView
x:Name
=
"countryTree"
>
<
telerik:RadTreeViewItem
IsExpanded
=
"True"
Header
=
"Country"
>
<
telerik:RadTreeViewItem
Header
=
"Russia"
/>
<
telerik:RadTreeViewItem
Header
=
"Czech Republic"
/>
<
telerik:RadTreeViewItem
Header
=
"Poland"
/>
<
telerik:RadTreeViewItem
Header
=
"Greece"
/>
<
telerik:RadTreeViewItem
Header
=
"Germany"
/>
<
telerik:RadTreeViewItem
Header
=
"Portugal"
/>
<
telerik:RadTreeViewItem
Header
=
"Denmark"
/>
<
telerik:RadTreeViewItem
Header
=
"Netherlands"
/>
<
telerik:RadTreeViewItem
Header
=
"Spain"
/>
<
telerik:RadTreeViewItem
Header
=
"Croatia"
/>
<
telerik:RadTreeViewItem
Header
=
"Italy"
/>
<
telerik:RadTreeViewItem
Header
=
"Ireland"
/>
<
telerik:RadTreeViewItem
Header
=
"Ukraine"
/>
<
telerik:RadTreeViewItem
Header
=
"England"
/>
<
telerik:RadTreeViewItem
Header
=
"France"
/>
<
telerik:RadTreeViewItem
Header
=
"Sweden"
/>
</
telerik:RadTreeViewItem
>
</
telerik:RadTreeView
>
<
Canvas
Grid.Column
=
"1"
x:Name
=
"canvas"
/>
</
Grid
>
</
UserControl
>
using
System.Windows.Controls;
using
Telerik.Windows.Controls.DragDrop;
namespace
RadControlsSilverlightApp1
{
public
partial
class
MainPage : UserControl
{
public
MainPage()
{
InitializeComponent();
RadDragAndDropManager.AddDropInfoHandler(canvas, OnDropInfo);
RadDragAndDropManager.AddDropQueryHandler(canvas, OnDropQuery);
RadDragAndDropManager.SetAllowDrop(canvas,
true
);
RadDragAndDropManager.AddDragInfoHandler(countryTree, OnDragInfo);
RadDragAndDropManager.AddDragQueryHandler(countryTree, OnDragQuery);
RadDragAndDropManager.SetAllowDrag(countryTree,
true
);
}
private
void
OnDropInfo(
object
sender, DragDropEventArgs e)
{
var droppablePanel = e.Options.Destination;
if
(e.Options.Status == DragStatus.DropComplete && droppablePanel
is
Canvas)
{
}
}
private
void
OnDropQuery(
object
sender, DragDropQueryEventArgs e)
{
var droppablePanel = e.Options.Destination;
if
(e.Options.Status == DragStatus.DropDestinationQuery && droppablePanel
is
Canvas)
{
e.QueryResult =
true
;
e.Handled =
true
;
}
}
private
void
OnDragInfo(
object
sender, DragDropEventArgs e)
{
if
(e.Options.Status == DragStatus.DragComplete)
{
}
}
private
void
OnDragQuery(
object
sender, DragDropQueryEventArgs e)
{
if
(e.Options.Status == DragStatus.DragQuery)
{
#region Silverlight 5
if
(e.Options.Source
is
Telerik.Windows.Controls.RadTreeView)
{
Telerik.Windows.Controls.RadTreeView draggedTreeView = e.Options.Source
as
Telerik.Windows.Controls.RadTreeView;
if
(draggedTreeView.SelectedItem !=
null
)
{
Telerik.Windows.Controls.RadTreeViewItem draggedTreeViewItem = draggedTreeView.SelectedItem
as
Telerik.Windows.Controls.RadTreeViewItem;
if
(draggedTreeViewItem !=
null
)
{
e.Options.DragCue = draggedTreeViewItem.Header;
}
}
}
#endregion
#region Silverlight 4
else
if
(e.Options.Source
is
Telerik.Windows.Controls.RadTreeViewItem)
{
Telerik.Windows.Controls.RadTreeViewItem draggedTreeViewItem = e.Options.Source
as
Telerik.Windows.Controls.RadTreeViewItem;
if
(draggedTreeViewItem !=
null
)
{
e.Options.DragCue = draggedTreeViewItem.Header;
}
}
#endregion
}
e.QueryResult =
true
;
e.Handled =
true
;
}
}
}