3 Answers, 1 is accepted
0
Hi Varun,
Hope it helps! Kind regards,
Nik
the Telerik team
You can easily achieve it by using the following snippet:
public
MainWindow()
{
InitializeComponent();
DragDropManager.AddDropHandler(
this
.GridView, OnDrop);
this
.GridView.ItemsSource =
this
.Paths;
}
private
void
OnDrop(
object
sender, Telerik.Windows.DragDrop.DragEventArgs e)
{
var data = e.Data
as
DataObject;
if
(data !=
null
&& data.ContainsFileDropList())
{
var list = data.GetFileDropList();
foreach
(var path
in
list)
{
this
.Paths.Add(
new
FilePath() { Path = path });
}
}
}
Hope it helps! Kind regards,
Nik
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
0

Ashok
Top achievements
Rank 1
answered on 07 Feb 2013, 07:34 AM
Hi Nik,
Thanks for the reply.
I had done the same implementation & it worked in my system.
But when i do the same in other PC (having same development environment of mine) the drop is not allowed.
The mouse icon shows a crossed symbol. I have set the AllowDrop property to true in the xaml file.
i tried in 2 more systems, but the same problem.
What could be the reason for this?
Code:
In Constructor:
Thanks,
Varun R
Thanks for the reply.
I had done the same implementation & it worked in my system.
But when i do the same in other PC (having same development environment of mine) the drop is not allowed.
The mouse icon shows a crossed symbol. I have set the AllowDrop property to true in the xaml file.
i tried in 2 more systems, but the same problem.
What could be the reason for this?
Code:
<
telerik:RadGridView
x:Name
=
"dgAttchdDocs"
AllowDrop
=
"True"
RowIndicatorVisibility
=
"Collapsed"
CanUserFreezeColumns
=
"False"
AutoGenerateColumns
=
"False"
GroupRenderMode
=
"Flat"
GridLinesVisibility
=
"None"
IsReadOnly
=
"True"
ShowGroupPanel
=
"False"
HorizontalAlignment
=
"Left"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
UniqueName
=
"Name"
Header
=
"Attached Document"
DataMemberBinding
=
"{Binding Name}"
Width
=
"250"
></
telerik:GridViewDataColumn
>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
In Constructor:
DragDropManager.AddDropHandler(this.dgAttchdDocs, OnDrop);
private void OnDrop(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
{
if (e.Effects != DragDropEffects.None)
{
var dataObject = e.Data as DataObject;
if (dataObject != null && dataObject.ContainsFileDropList())
{
foreach (var item in dataObject.GetFileDropList())
{
if (item.ToString().Substring(item.ToString().Length - 4, 4).ToUpper() == ".PDF")
{
EOAttachment Attachment = new EOAttachment();
Attachment.Name = System.IO.Path.GetFileName(item.ToString());
this.dgAttchdDocs.Items.Add(Attachment);
}
else
{
MessageBox.Show("Only PDF files can be attached.", "Quantum", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
}
}
}
Thanks,
Varun R
0
Hi Varun,
Nik
the Telerik team
Dragging operations between your applications and other ones, sometimes requires the application to be in FullTrust permissions. Can you check if the other machines don't offer the necessary permitions to your app?
Hope this helps!
Nik
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.