ExcelHelper/Views/Pages/ImportExcelPage.xaml

117 lines
5.2 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<Page
x:Class="ExcelHelper.Views.Pages.ImportExcelPage"
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:hc="https://handyorg.github.io/handycontrol"
xmlns:local="clr-namespace:ExcelHelper.Views.Pages"
xmlns:utils="clr-namespace:ExcelHelper.Utils"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:viewmodels="clr-namespace:ExcelHelper.Views.ViewModels"
Title="ImportExcelPage"
d:DataContext="{d:DesignInstance Type=viewmodels:ImportViewModel}"
d:DesignHeight="450"
d:DesignWidth="1200"
mc:Ignorable="d">
<Page.Resources>
<DataTemplate x:Key="Mask">
<Grid Background="#99424242">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="20"
Foreground="White"
Text="拖拽到此处放开" />
</Grid>
</DataTemplate>
</Page.Resources>
<Grid
AllowDrop="True"
DragEnter="Grid_DragEnter"
DragLeave="Grid_DragLeave"
Drop="Grid_Drop">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" MinWidth="800" />
<ColumnDefinition Width="370" MinWidth="370" />
</Grid.ColumnDefinitions>
<ContentPresenter
x:Name="DropFileMask"
Grid.Column="0"
Grid.ColumnSpan="2"
Panel.ZIndex="10"
ContentTemplate="{StaticResource Mask}"
Visibility="Collapsed" />
<hc:TabControl Grid.Column="0" Margin="5,5,7,5">
<hc:TabItem Header="预览">
<DataGrid IsReadOnly="True" x:Name="ExcelDataPreviewGrid" AutoGenerateColumns="False" ColumnWidth="Auto" ItemsSource="{Binding ExcelData}" />
</hc:TabItem>
<hc:TabItem Header="列信息">
<DataGrid>
<DataGrid.Columns >
<DataGridTextColumn Header="列" />
</DataGrid.Columns>
</DataGrid>
</hc:TabItem>
</hc:TabControl>
<GridSplitter
Grid.Column="0"
Width="2"
Margin="0,5" />
<GroupBox
Grid.Column="1"
Margin="5"
Padding="5">
<GroupBox.Header>
<StackPanel Orientation="Horizontal">
<TextBlock
Margin="5,0"
VerticalAlignment="Center"
Text="参数配置" />
<Button VerticalAlignment="Center" Content="重新读取Excel" />
</StackPanel>
</GroupBox.Header>
<hc:SimpleStackPanel SnapsToDevicePixels="True">
<hc:SimpleStackPanel.Resources>
<Style TargetType="{x:Type hc:SimpleStackPanel}">
<Setter Property="Margin" Value="5,0" />
</Style>
</hc:SimpleStackPanel.Resources>
<hc:SimpleStackPanel Orientation="Horizontal">
<Label Content="指定的Sheet" />
<hc:ComboBox MinWidth="60" Margin="0" ItemsSource="{Binding Sheets}" SelectedValue="{Binding SelectedSheetName}" />
<Button
Margin="0"
VerticalAlignment="Center"
Content="读取Excel" />
</hc:SimpleStackPanel>
<hc:SimpleStackPanel Height="Auto" Orientation="Horizontal">
<Label Content="起始位置:" />
<hc:TextBox MinWidth="40" Text="{Binding StartCell}" />
<CheckBox Content="包含列头" IsChecked="{Binding UseHeaderRow}" />
</hc:SimpleStackPanel>
<hc:SimpleStackPanel Orientation="Horizontal">
<Label Content="结束位置:" />
<hc:TextBox MinWidth="40" Text="{Binding EndCell}" />
</hc:SimpleStackPanel>
<hc:SimpleStackPanel Orientation="Horizontal">
<Label Content="最大读取行数:" />
<hc:NumericUpDown MinWidth="40" Minimum="1" Value="{Binding MaxRow}" />
</hc:SimpleStackPanel>
<hc:SimpleStackPanel Width="Auto" Orientation="Horizontal">
<Label Content="当前文件路径:" />
<!--<hc:TextBox MinWidth="200" />-->
<hc:ComboBox ItemsSource="{Binding ExcelFiles}" SelectedValue="{Binding CurrentFilePath}" MaxWidth="200" />
</hc:SimpleStackPanel>
<hc:SimpleStackPanel Orientation="Horizontal">
<Label Content="Excel密码" />
<PasswordBox utils:PasswordBoxHelper.Password="{Binding ExcelPassword, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" MinWidth="60" />
<Button Content="?" ToolTip="未加密留空多个Excel如果不同密码请分批次导入" />
</hc:SimpleStackPanel>
</hc:SimpleStackPanel>
</GroupBox>
</Grid>
</Page>