winforms拖放文件中的C#WPF文本框 [英] C# WPF textbox in winforms drag and drop file

查看:56
本文介绍了winforms拖放文件中的C#WPF文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以将要读取的文本文件拖放到WinForms的文本框中,没问题。



但是我需要在我的文本框中有一个WPF文本框WinForms并执行相同的操作。(与WinForms版本不同,在执行未请求的换行之前可能需要超过1024个字符)



可以有人在c#中做了一个简单的例子,他们已经过测试验证它是否有效。



我尝试过的事情:



如上所述尝试



I can drag and drop a text file to be read into a textbox in a WinForms, no problem.

However I need to have a WPF textbox in my WinForms and perform the same action.(It can take more than 1024 characters before an unrequested wrap is performed unlike the WinForms version)

Can someone make a simple example in c# that they have tested to verify it works.

What I have tried:

Tried as stated above

<Canvas>
    <TextBox x:Name="textboxJon" HorizontalAlignment="Left" Height="257" Margin="138,90,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="524"   AllowDrop="True" DragEnter="textboxJon_DragEnter" DragDrop.Drop="textboxJon_DragDrop"/>

</Canvas>

推荐答案

我在此链接上发布了我的解决方案

如何获得Windows窗体中托管的WPF文本框的拖放事件 [ ^ ]
I posted my solution at this link
How do you get a drag and drop event for a WPF textbox hosted in a Windows Form[^]


这篇关于winforms拖放文件中的C#WPF文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆