XFEstudio/MyFirstRespo
完善部分页面
05e4709
代码差异
7 个文件
+67
-36
@@ -5,8 +5,7 @@
5
5
<Setter Property="Template">
6
6
<Setter.Value>
7
7
<ControlTemplate TargetType="{x:Type ctr:RoundButton}">
8
<Grid>
9
<ContentControl/>
8
<Grid x:Name="grid">
10
9
<Border x:Name="backBorder" CornerRadius="{TemplateBinding RoundCornerRadius}" Background="{TemplateBinding RoundButtonBackground}" Opacity="0"/>
11
10
<Border CornerRadius="{TemplateBinding RoundCornerRadius}" BorderBrush="{TemplateBinding RoundButtonBorderBrush}" BorderThickness="{TemplateBinding RoundButtonBorderThickness}">
12
11
<ContentPresenter Content="{TemplateBinding Content}"/>
@@ -35,7 +34,7 @@
35
34
</Storyboard>
36
35
</BeginStoryboard>
37
36
</EventTrigger>
38
<EventTrigger RoutedEvent="MouseLeftButtonDown">
37
<EventTrigger RoutedEvent="PreviewMouseLeftButtonDown">
39
38
<BeginStoryboard>
40
39
<Storyboard>
41
40
<DoubleAnimation Storyboard.TargetName="backBorder" Storyboard.TargetProperty="Opacity" To="0.3" Duration="0:0:0.3">
@@ -46,7 +45,7 @@
46
45
</Storyboard>
47
46
</BeginStoryboard>
48
47
</EventTrigger>
49
<EventTrigger RoutedEvent="MouseLeftButtonUp">
48
<EventTrigger RoutedEvent="PreviewMouseLeftButtonUp">
50
49
<BeginStoryboard>
51
50
<Storyboard>
52
51
<DoubleAnimation Storyboard.TargetName="backBorder" Storyboard.TargetProperty="Opacity" To="0.1" Duration="0:0:0.3">
@@ -343,4 +342,24 @@
343
342
</Setter.Value>
344
343
</Setter>
345
344
</Style>
345
<Style TargetType="{x:Type ctr:HintTextBox}">
346
<Setter Property="Template">
347
<Setter.Value>
348
<ControlTemplate TargetType="{x:Type ctr:HintTextBox}">
349
350
</ControlTemplate>
351
</Setter.Value>
352
</Setter>
353
</Style>
354
<Style x:Key="TextEditor" TargetType="{x:Type ctr:TextEditor}">
355
<Setter Property="Template">
356
<Setter.Value>
357
<ControlTemplate TargetType="{x:Type ctr:TextEditor}">
358
<Border Padding="{TemplateBinding Padding}" CornerRadius="{TemplateBinding EditorCornerRadius}" BorderBrush="{TemplateBinding EditorBorderBrush}" BorderThickness="{TemplateBinding EditorBorderThickness}">
359
<ctr:HintTextBox BorderThickness="0" Background="{TemplateBinding Background}" Foreground="{TemplateBinding Foreground}" HintBackground="{TemplateBinding HintBackground}" HintForeground="{TemplateBinding HintForeground}" HintText="{TemplateBinding HintText}" HintFontSize="{TemplateBinding HintFontSize}" HintFontFamily="{TemplateBinding HintFontFamily}" HintFontWeight="{TemplateBinding HintFontWeight}" HintTextHorizontalAlignment="{TemplateBinding HintTextHorizontalAlignment}" HintTextVerticalAlignment="{TemplateBinding HintTextVerticalAlignment}" HintTextMargin="{TemplateBinding HintTextMargin}" HintTextOpacity="{TemplateBinding HintTextOpacity}"/>
360
</Border>
361
</ControlTemplate>
362
</Setter.Value>
363
</Setter>
364
</Style>
346
365
</ResourceDictionary>
@@ -1,6 +1,4 @@
1
1
using System.Reflection;
2
using System.Windows.Media;
3
using System.Windows;
4
2
5
3
namespace XFEToolBox.Utilities;
6
4
@@ -11,7 +11,6 @@ public partial class HintTextBox : TextBox
11
11
{
12
12
public HintTextBox()
13
13
{
14
InitializeComponent();
15
14
}
16
15
public string HintText
17
16
{
@@ -68,4 +67,18 @@ public partial class HintTextBox : TextBox
68
67
set { SetValue(HintTextOpacityProperty, value); }
69
68
}
70
69
public static readonly DependencyProperty HintTextOpacityProperty = DependencyProperty.Register("HintTextOpacity", typeof(double), typeof(HintTextBox), new PropertyMetadata(0.5d));
70
71
public VerticalAlignment HintTextVerticalAlignment
72
{
73
get { return (VerticalAlignment)GetValue(HintTextVerticalAlignmentProperty); }
74
set { SetValue(HintTextVerticalAlignmentProperty, value); }
75
}
76
public static readonly DependencyProperty HintTextVerticalAlignmentProperty = DependencyProperty.Register("HintTextVerticalAlignment", typeof(VerticalAlignment), typeof(HintTextBox), new PropertyMetadata(VerticalAlignment.Center));
77
78
public HorizontalAlignment HintTextHorizontalAlignment
79
{
80
get { return (HorizontalAlignment)GetValue(HintTextHorizontalAlignmentProperty); }
81
set { SetValue(HintTextHorizontalAlignmentProperty, value); }
82
}
83
public static readonly DependencyProperty HintTextHorizontalAlignmentProperty = DependencyProperty.Register("HintTextHorizontalAlignment", typeof(HorizontalAlignment), typeof(HintTextBox), new PropertyMetadata(HorizontalAlignment.Left));
71
84
}
@@ -1,28 +0,0 @@
1
<TextBox x:Class="XFEToolBox.Views.Controls.HintTextBox"
2
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6
xmlns:local="clr-namespace:XFEToolBox.Views.Controls"
7
mc:Ignorable="d"
8
d:DesignHeight="450" d:DesignWidth="800" x:Name="hintTextBox">
9
<TextBox.Resources>
10
<VisualBrush x:Key="hintVisualBrush" TileMode="None" Stretch="None" AlignmentX="Left">
11
<VisualBrush.Visual>
12
<TextBlock x:Name="hintTextBlock" Text="{Binding ElementName=hintTextBox, Path=HintText}" Foreground="{Binding ElementName=hintTextBox, Path=HintForeground}" Background="{Binding ElementName=hintTextBox, Path=HintBackground}" FontFamily="{Binding ElementName=hintTextBox, Path=HintFontFamily}" FontSize="{Binding ElementName=hintTextBox, Path=HintFontSize}" Margin="{Binding ElementName=hintTextBox, Path=HintTextMargin}" Opacity="{Binding ElementName=hintTextBox, Path=HintTextOpacity}"/>
13
</VisualBrush.Visual>
14
</VisualBrush>
15
</TextBox.Resources>
16
<TextBox.Style>
17
<Style TargetType="TextBox">
18
<Style.Triggers>
19
<Trigger Property="Text" Value="">
20
<Setter Property="Background" Value="{StaticResource hintVisualBrush}" />
21
</Trigger>
22
<Trigger Property="Text" Value="{x:Null}">
23
<Setter Property="Background" Value="{StaticResource hintVisualBrush}" />
24
</Trigger>
25
</Style.Triggers>
26
</Style>
27
</TextBox.Style>
28
</TextBox>
@@ -6,6 +6,7 @@ namespace XFEToolBox.Views.Controls;
6
6
7
7
public class RoundButton : Button
8
8
{
9
9
10
public CornerRadius RoundCornerRadius
10
11
{
11
12
get { return (CornerRadius)GetValue(RoundCornerRadiusProperty); }
@@ -0,0 +1,28 @@
1
using System.Windows;
2
using System.Windows.Media;
3
4
namespace XFEToolBox.Views.Controls;
5
6
public class TextEditor : HintTextBox
7
{
8
public CornerRadius EditorCornerRadius
9
{
10
get { return (CornerRadius)GetValue(EditorCornerRadiusProperty); }
11
set { SetValue(EditorCornerRadiusProperty, value); }
12
}
13
public static readonly DependencyProperty EditorCornerRadiusProperty = DependencyProperty.Register("EditorCornerRadius", typeof(CornerRadius), typeof(TextEditor), new PropertyMetadata(new CornerRadius(10)));
14
15
public Thickness EditorBorderThickness
16
{
17
get { return (Thickness)GetValue(EditorBorderThicknessProperty); }
18
set { SetValue(EditorBorderThicknessProperty, value); }
19
}
20
public static readonly DependencyProperty EditorBorderThicknessProperty = DependencyProperty.Register("EditorBorderThickness", typeof(Thickness), typeof(TextEditor), new PropertyMetadata(new Thickness(1)));
21
22
public Brush EditorBorderBrush
23
{
24
get { return (Brush)GetValue(EditorBorderBrushProperty); }
25
set { SetValue(EditorBorderBrushProperty, value); }
26
}
27
public static readonly DependencyProperty EditorBorderBrushProperty = DependencyProperty.Register("EditorBorderBrush", typeof(Brush), typeof(TextEditor), new PropertyMetadata(new SolidColorBrush(Color.FromRgb(152, 152, 231))));
28
}
@@ -75,7 +75,7 @@
75
75
<TextBlock VerticalAlignment="Center" Text="控制台" Style="{StaticResource TabUnderLineText}" Tag="控制台"/>
76
76
<Border Background="{DynamicResource MainColor}" VerticalAlignment="Bottom" HorizontalAlignment="Stretch" Height="1"/>
77
77
<StackPanel Grid.Row="1">
78
<ctr:HintTextBox/>
78
<ctr:TextEditor Style="{StaticResource TextEditor}" Margin="0,10" Padding="5" HintText="3280"/>
79
79
<ctr:SwitchButton Command="{Binding SwitchedCommand}" CommandParameter="{Binding RelativeSource={x:Static RelativeSource.Self}}" Tag="XFEToolBox.Profiles.CrossVersionProfiles.ConsoleProfile.LocalHostOnly">
80
80
<TextBlock Text="只对本地回环开放(localhost)"/>
81
81
</ctr:SwitchButton>