This question is locked. New answers and comments are not allowed.
Hi Telerik Team!
My problem is a drag and drop feature which drags different file formats such as .txt .doc. pdf format into one container... An example of code is this...
In MainPage.xaml
<UserControl x:Class="DesktopDragandDrop.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="336" d:DesignWidth="440">
<Grid x:Name="LayoutRoot" Background="White">
<Grid.RowDefinitions>
<RowDefinition Height="200" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid Grid.Row="0" AllowDrop="True" Drop="LayoutRoot_Drop" Background="#f0f0f0">
<TextBlock Text="Drop some files here!" FontSize="24" TextAlignment="Center" VerticalAlignment="Center" />
</Grid>
<TextBlock x:Name="output" Grid.Row="1" />
</Grid>
</UserControl>
While, in MainPage.xaml.cs ...
namespace DesktopDragandDrop
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
}
private void LayoutRoot_Drop(object sender, DragEventArgs e)
{
FileInfo[] files = ( FileInfo[])e.Data.GetData(System.Windows.DataFormats.FileDrop);
StringBuilder content = new StringBuilder();
foreach (FileInfo file in files)
{
content.Append(file.Name);
content.Append(Environment.NewLine);
}
output.Text = content.ToString();
}
}
}
In this code, we can drop only the filename of the file into a textblock... How can I drop the real content of .txt file or .doc file or .pdf file into a container?
I hope you can answer this question..
Thank you!
My problem is a drag and drop feature which drags different file formats such as .txt .doc. pdf format into one container... An example of code is this...
In MainPage.xaml
<UserControl x:Class="DesktopDragandDrop.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="336" d:DesignWidth="440">
<Grid x:Name="LayoutRoot" Background="White">
<Grid.RowDefinitions>
<RowDefinition Height="200" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid Grid.Row="0" AllowDrop="True" Drop="LayoutRoot_Drop" Background="#f0f0f0">
<TextBlock Text="Drop some files here!" FontSize="24" TextAlignment="Center" VerticalAlignment="Center" />
</Grid>
<TextBlock x:Name="output" Grid.Row="1" />
</Grid>
</UserControl>
While, in MainPage.xaml.cs ...
namespace DesktopDragandDrop
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
}
private void LayoutRoot_Drop(object sender, DragEventArgs e)
{
FileInfo[] files = ( FileInfo[])e.Data.GetData(System.Windows.DataFormats.FileDrop);
StringBuilder content = new StringBuilder();
foreach (FileInfo file in files)
{
content.Append(file.Name);
content.Append(Environment.NewLine);
}
output.Text = content.ToString();
}
}
}
In this code, we can drop only the filename of the file into a textblock... How can I drop the real content of .txt file or .doc file or .pdf file into a container?
I hope you can answer this question..
Thank you!