Browse Source

Form表单-补充提交

ZhouJieSheng 2 năm trước cách đây
mục cha
commit
bf5b4bb474

+ 64 - 0
PDF Office/CustomControl/TextBoxEx.cs

@@ -0,0 +1,64 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Media;
+
+namespace PDF_Office.CustomControl
+{
+    /// <summary>
+    /// 带预文本和圆角的textbox
+    /// </summary>
+    public class TextBoxEx : TextBox
+    {
+        static TextBoxEx()
+        {
+            DefaultStyleKeyProperty.OverrideMetadata(typeof(TextBoxEx), new FrameworkPropertyMetadata(typeof(TextBoxEx)));
+        }
+
+        //TextBox调用该OnApplyTemplate函数后,光标无效
+        //public override void OnApplyTemplate(){ }
+        public string PlaceholderText
+        {
+            get { return (string)GetValue(PlaceholderTextProperty); }
+            set { SetValue(PlaceholderTextProperty, value); }
+        }
+
+        public static readonly DependencyProperty PlaceholderTextProperty
+        = DependencyProperty.Register("PlaceholderText", typeof(string), typeof(TextBoxEx), null);
+
+        public CornerRadius CornerRadius
+        {
+            get { return (CornerRadius)GetValue(CornerRadiusProperty); }
+            set { SetValue(CornerRadiusProperty, value); }
+        }
+
+        public static readonly DependencyProperty CornerRadiusProperty =
+            DependencyProperty.Register("CornerRadius", typeof(CornerRadius), typeof(TextBoxEx), new PropertyMetadata(new CornerRadius(4)));
+
+        public Brush PlaceholderForeground
+        {
+            get { return (Brush)GetValue(PlaceholderForegroundProperty); }
+            set { SetValue(PlaceholderForegroundProperty, value); }
+        }
+
+        public static readonly DependencyProperty PlaceholderForegroundProperty =
+          DependencyProperty.Register("PlaceholderForeground", typeof(Brush), typeof(TextBoxEx), new PropertyMetadata(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#94989C"))));
+
+        public Brush MouseOverForeground
+        {
+            get
+            {
+                return (Brush)GetValue(MouseOverForegroundProperty);
+            }
+            set { SetValue(MouseOverForegroundProperty, value); }
+        }
+
+        public static readonly DependencyProperty MouseOverForegroundProperty =
+     DependencyProperty.Register("MouseOverForeground", typeof(Brush), typeof(TextBoxEx), new PropertyMetadata(new SolidColorBrush(Colors.Transparent)));
+
+    }
+}

+ 54 - 0
PDF Office/CustomControl/TextBoxWithClear.xaml

@@ -0,0 +1,54 @@
+<UserControl
+    x:Class="PDF_Office.CustomControl.TextBoxWithClear"
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:cus="clr-namespace:PDF_Office.CustomControl"
+    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+    xmlns:local="clr-namespace:PDF_Office.CustomControl"
+    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    d:DesignHeight="450"
+    d:DesignWidth="800"
+    mc:Ignorable="d">
+    <UserControl.Template>
+        <ControlTemplate TargetType="{x:Type UserControl}">
+            <Grid>
+                <cus:TextBoxEx
+                    x:Name="Txt"
+                    Width="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:TextBoxWithClear}, Path=Width}"
+                    Height="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:TextBoxWithClear}, Path=Height}"
+                    Padding="0,0,16,0"
+                    VerticalAlignment="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:TextBoxWithClear}, Path=VerticalAlignment}"
+                    VerticalContentAlignment="Center"
+                    CornerRadius="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:TextBoxWithClear}, Path=CornerRadius}"
+                    PlaceholderText="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:TextBoxWithClear}, Path=PlaceHolderText}"
+                    Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:TextBoxWithClear}, Path=Text}" />
+                <Button
+                    Name="btnClear"
+                    Width="16"
+                    Height="16"
+                    Margin="9"
+                    HorizontalAlignment="Right"
+                    VerticalAlignment="Center"
+                    Background="Transparent"
+                    BorderThickness="0"
+                    Click="Button_Click"
+                    Style="{StaticResource NoColorBtn}"
+                    Visibility="Collapsed">
+                    <Path
+                        Data="M8 15C11.866 15 15 11.866 15 8C15 4.13401 11.866 1 8 1C4.13401 1 1 4.13401 1 8C1 11.866 4.13401 15 8 15ZM11.5303 5.53038L9.06069 8L11.5303 10.4696L10.4697 11.5303L8.00002 9.06066L5.53033 11.5303L4.46967 10.4697L6.93936 8L4.46967 5.53033L5.53033 4.46967L8.00002 6.93934L10.4697 4.46971L11.5303 5.53038Z"
+                        Fill="#CED0D4"
+                        Stretch="Uniform" />
+                </Button>
+            </Grid>
+            <ControlTemplate.Triggers>
+                <Trigger Property="IsMouseOver" Value="True">
+                    <Setter TargetName="btnClear" Property="Visibility" Value="Visible" />
+                </Trigger>
+                <Trigger Property="IsFocused" Value="True">
+                    <Setter TargetName="btnClear" Property="Visibility" Value="Visible" />
+                </Trigger>
+            </ControlTemplate.Triggers>
+        </ControlTemplate>
+
+    </UserControl.Template>
+</UserControl>

+ 72 - 0
PDF Office/CustomControl/TextBoxWithClear.xaml.cs

@@ -0,0 +1,72 @@
+using PDF_Office.Helper;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace PDF_Office.CustomControl
+{
+    /// <summary>
+    /// TextBoxWithClear.xaml 的交互逻辑
+    /// </summary>
+    public partial class TextBoxWithClear : UserControl
+    {
+        public TextBoxWithClear()
+        {
+            InitializeComponent();
+        }
+
+
+
+        public string PlaceHolderText
+        {
+            get { return (string)GetValue(PlaceHolderTextProperty); }
+            set { SetValue(PlaceHolderTextProperty, value); }
+        }
+
+        // Using a DependencyProperty as the backing store for PlaceHolderText.  This enables animation, styling, binding, etc...
+        public static readonly DependencyProperty PlaceHolderTextProperty =
+            DependencyProperty.Register("PlaceHolderText", typeof(string), typeof(TextBoxWithClear), new PropertyMetadata(""));
+
+
+
+        public string Text
+        {
+            get { return (string)GetValue(TextProperty); }
+            set { SetValue(TextProperty, value); }
+        }
+
+        // Using a DependencyProperty as the backing store for Text.  This enables animation, styling, binding, etc...
+        public static readonly DependencyProperty TextProperty =
+            DependencyProperty.Register("Text", typeof(string), typeof(TextBoxWithClear), new PropertyMetadata(""));
+
+        public CornerRadius CornerRadius
+        {
+            get { return (CornerRadius)GetValue(CornerRadiusProperty); }
+            set { SetValue(CornerRadiusProperty, value); }
+        }
+
+        public static readonly DependencyProperty CornerRadiusProperty =
+            DependencyProperty.Register("CornerRadius", typeof(CornerRadius), typeof(TextBoxWithClear), new PropertyMetadata(new CornerRadius(4)));
+
+        private void Button_Click(object sender, RoutedEventArgs e)
+        {
+            this.Text = "";
+            var textbox = CommonHelper.FindVisualChild<TextBoxEx>(this);
+            if(textbox!=null)
+            {
+                textbox.Focus();
+            }
+        }
+    }
+}

+ 12 - 0
PDF Office/Views/Form/ButtonProperty.xaml

@@ -0,0 +1,12 @@
+<UserControl x:Class="PDF_Office.Views.Form.ButtonProperty"
+             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:PDF_Office.Views.Form"
+             mc:Ignorable="d" 
+             d:DesignHeight="450" d:DesignWidth="800">
+    <Grid>
+            
+    </Grid>
+</UserControl>

+ 28 - 0
PDF Office/Views/Form/ButtonProperty.xaml.cs

@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace PDF_Office.Views.Form
+{
+    /// <summary>
+    /// ButtonProperty.xaml 的交互逻辑
+    /// </summary>
+    public partial class ButtonProperty : UserControl
+    {
+        public ButtonProperty()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 12 - 0
PDF Office/Views/Form/CheckBoxProperty.xaml

@@ -0,0 +1,12 @@
+<UserControl x:Class="PDF_Office.Views.Form.CheckBoxProperty"
+             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:PDF_Office.Views.Form"
+             mc:Ignorable="d" 
+             d:DesignHeight="450" d:DesignWidth="800">
+    <Grid>
+            
+    </Grid>
+</UserControl>

+ 28 - 0
PDF Office/Views/Form/CheckBoxProperty.xaml.cs

@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace PDF_Office.Views.Form
+{
+    /// <summary>
+    /// CheckBoxProperty.xaml 的交互逻辑
+    /// </summary>
+    public partial class CheckBoxProperty : UserControl
+    {
+        public CheckBoxProperty()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 12 - 0
PDF Office/Views/Form/ComboxProperty.xaml

@@ -0,0 +1,12 @@
+<UserControl x:Class="PDF_Office.Views.Form.ComboxProperty"
+             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:PDF_Office.Views.Form"
+             mc:Ignorable="d" 
+             d:DesignHeight="450" d:DesignWidth="800">
+    <Grid>
+            
+    </Grid>
+</UserControl>

+ 28 - 0
PDF Office/Views/Form/ComboxProperty.xaml.cs

@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace PDF_Office.Views.Form
+{
+    /// <summary>
+    /// ComboxProperty.xaml 的交互逻辑
+    /// </summary>
+    public partial class ComboxProperty : UserControl
+    {
+        public ComboxProperty()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 12 - 0
PDF Office/Views/Form/ListBoxProperty.xaml

@@ -0,0 +1,12 @@
+<UserControl x:Class="PDF_Office.Views.Form.ListBoxProperty"
+             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:PDF_Office.Views.Form"
+             mc:Ignorable="d" 
+             d:DesignHeight="450" d:DesignWidth="800">
+    <Grid>
+            
+    </Grid>
+</UserControl>

+ 28 - 0
PDF Office/Views/Form/ListBoxProperty.xaml.cs

@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace PDF_Office.Views.Form
+{
+    /// <summary>
+    /// ListBoxProperty.xaml 的交互逻辑
+    /// </summary>
+    public partial class ListBoxProperty : UserControl
+    {
+        public ListBoxProperty()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 12 - 0
PDF Office/Views/Form/RadioButtonProperty.xaml

@@ -0,0 +1,12 @@
+<UserControl x:Class="PDF_Office.Views.Form.RadioButtonProperty"
+             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:PDF_Office.Views.Form"
+             mc:Ignorable="d" 
+             d:DesignHeight="450" d:DesignWidth="800">
+    <Grid>
+            
+    </Grid>
+</UserControl>

+ 28 - 0
PDF Office/Views/Form/RadioButtonProperty.xaml.cs

@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace PDF_Office.Views.Form
+{
+    /// <summary>
+    /// RadioButtonProperty.xaml 的交互逻辑
+    /// </summary>
+    public partial class RadioButtonProperty : UserControl
+    {
+        public RadioButtonProperty()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 12 - 0
PDF Office/Views/Form/SignProperty.xaml

@@ -0,0 +1,12 @@
+<UserControl x:Class="PDF_Office.Views.Form.SignProperty"
+             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:PDF_Office.Views.Form"
+             mc:Ignorable="d" 
+             d:DesignHeight="450" d:DesignWidth="800">
+    <Grid>
+            
+    </Grid>
+</UserControl>

+ 28 - 0
PDF Office/Views/Form/SignProperty.xaml.cs

@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace PDF_Office.Views.Form
+{
+    /// <summary>
+    /// SignProperty.xaml 的交互逻辑
+    /// </summary>
+    public partial class SignProperty : UserControl
+    {
+        public SignProperty()
+        {
+            InitializeComponent();
+        }
+    }
+}

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 411 - 0
PDF Office/Views/Form/TextFieldProperty.xaml


+ 28 - 0
PDF Office/Views/Form/TextFieldProperty.xaml.cs

@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace PDF_Office.Views.Form
+{
+    /// <summary>
+    /// TextFieldProperty.xaml 的交互逻辑
+    /// </summary>
+    public partial class TextFieldProperty : UserControl
+    {
+        public TextFieldProperty()
+        {
+            InitializeComponent();
+        }
+    }
+}