如何选择excel文件WPF? [英] How to select excel file WPF?

查看:111
本文介绍了如何选择excel文件WPF?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我单击选择按钮时,我想选择文件选择字段并根据文件夹选择选项。

如何通过xmal进行Excel选择?

我试图定义方法和属性,但我不能这样做。



我尝试了什么:



When I click the Select button, I want to select the file selection field and select the option according to the folder.
How can I make an Excel selection by xmal?
I tried to define the method and property, but I couldn't do it.

What I have tried:

<Page x:Class="MyWpfProject.InsertFile"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:local="clr-namespace:MyWpfProject"
      mc:Ignorable="d" 
      d:DesignHeight="450" d:DesignWidth="800"
      Title="InsertFile">

    <Grid>
        <Button x:Name="button" Content="Choose Excel" HorizontalAlignment="Left" VerticalAlignment="Top" Width="75" Margin="570,82,0,0"/>
        <TextBox x:Name="textBox" HorizontalAlignment="Left" Height="23" TextWrapping="Wrap" Text="{Binding TextExcel}" VerticalAlignment="Top" Width="251" Margin="271,79,0,0"/>
        <Label x:Name="label"  Content="Select Excel File"  HorizontalAlignment="Left" VerticalAlignment="Top" RenderTransformOrigin="4.223,3.153" Height="37" Width="134" Margin="114,75,0,0"/>
        <Button x:Name="button1" Content="InsertFile" HorizontalAlignment="Left" Command="{Binding ContactBtnClickExcelCommand}" VerticalAlignment="Top" Width="75" Margin="361,185,0,0"/>

    </Grid>
</Page>

推荐答案

OpenFileDialog - 完整的WPF教程 [ ^ ]


这篇关于如何选择excel文件WPF?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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