Blend 3中的OpenFileDialog ??? [英] OpenFileDialog in Blend 3???

查看:41
本文介绍了Blend 3中的OpenFileDialog ???的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用Expression Blend 3制作一个WPF项目,该项目执行以下操作:
按下按钮 - >打开FileDialog - >从我的电脑中选择一个文件 - >拿文件名打开它

我怎么能在Blend中做到这一点?因为我找不到类似于.NET的OpenFileDialog。

解决方案

< span style ="font-family:Consolas; font-size:x-small">

OpenFileDialog位于 < span style ="font-family:Consolas; font-size:x-small"> Microsoft.Win32

1。在Blend中,画一个按钮
2。在属性面板中,单击"事件"按钮,在"单击"事件上,键入您喜欢的方法名称,例如。中openFile
3。 Blend将自动填充page.xaml.cs并为您添加事件处理程序方法:
private void openFile( 对象 sender,System.Windows.RoutedEventArgs e){}
4。您需要在方法中添加2行:
OpenFileDialog ofd =
OpenFileDialog();
ofd.ShowDialog();
5。不要忘记添加"使用Microsoft.Win32;"在文件的顶部
6。按F5键进行测试运行,单击按钮后可以看到OpenFileDialog。



I want to make with Expression Blend 3 a WPF project which does the following:
 Press a Button --> Opens a FileDialog --> Choose a file from my computer --> Take the file's name to open it

How can i do that in Blend? Because i cannot find something similar to OpenFileDialog from .NET.

解决方案

OpenFileDialog is in Microsoft.Win32

1. In Blend, draw a button
2. From properties panel, click on Events button, on Click event, type in method name you prefer, eg. openFile
3. Blend will auto lauch the page.xaml.cs and add the event handler method for you:
 private void openFile(object sender, System.Windows.RoutedEventArgs e){}
4. You need to add 2 lines inside the method:
             OpenFileDialog ofd =
new OpenFileDialog();
             ofd.ShowDialog();
5. Don't forget to add "using Microsoft.Win32;" on top of the file
6. hit F5 to test run, you can see the OpenFileDialog after clicking the button.


这篇关于Blend 3中的OpenFileDialog ???的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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