|
@@ -7,7 +7,9 @@
|
|
|
|
|
|
|
|
|
using System;
|
|
|
+using System.Globalization;
|
|
|
using System.Windows;
|
|
|
+using System.Windows.Data;
|
|
|
using System.Windows.Forms;
|
|
|
using System.Windows.Media;
|
|
|
using System.Windows.Media.Imaging;
|
|
@@ -15,29 +17,35 @@ using System.Windows.Media.Imaging;
|
|
|
namespace SAGA.DotNetUtils.WPF.UserControl
|
|
|
{
|
|
|
/// <summary>
|
|
|
- /// SelectPath_Start.xaml 的交互逻辑
|
|
|
+ /// SelectPath.xaml 的交互逻辑
|
|
|
/// </summary>
|
|
|
- public partial class SelectPath_Start
|
|
|
+ public partial class SelectPath
|
|
|
{
|
|
|
- public SelectPath_Start()
|
|
|
+ public SelectPath()
|
|
|
{
|
|
|
InitializeComponent();
|
|
|
}
|
|
|
- public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(SelectPath_Start));
|
|
|
+ public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(SelectPath));
|
|
|
public string Text
|
|
|
{
|
|
|
get { return (string)GetValue(TextProperty); }
|
|
|
set { SetValue(TextProperty, value); }
|
|
|
}
|
|
|
+ public static readonly DependencyProperty ButtonPositionProperty = DependencyProperty.Register("ButtonPosition", typeof(ButtonPosition), typeof(SelectPath));
|
|
|
+ public ButtonPosition ButtonPosition
|
|
|
+ {
|
|
|
+ get { return (ButtonPosition)GetValue(ButtonPositionProperty); }
|
|
|
+ set { SetValue(ButtonPositionProperty, value); }
|
|
|
+ }
|
|
|
|
|
|
- public static readonly DependencyProperty BtnImageProperty = DependencyProperty.Register("BtnImage", typeof(ImageSource), typeof(SelectPath_Start));
|
|
|
+ public static readonly DependencyProperty BtnImageProperty = DependencyProperty.Register("BtnImage", typeof(ImageSource), typeof(SelectPath));
|
|
|
public ImageSource BtnImage
|
|
|
{
|
|
|
get { return (ImageSource)GetValue(BtnImageProperty); }
|
|
|
set { SetValue(BtnImageProperty, value); }
|
|
|
}
|
|
|
|
|
|
- public Action<System.Windows.Controls.UserControl,string> AttachAction;
|
|
|
+ public Action<System.Windows.Controls.UserControl, string> AttachAction;
|
|
|
|
|
|
private void Button_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
@@ -48,9 +56,40 @@ namespace SAGA.DotNetUtils.WPF.UserControl
|
|
|
{
|
|
|
string foldPath = dialog.SelectedPath;
|
|
|
Text = foldPath;
|
|
|
- AttachAction?.Invoke(this,foldPath);
|
|
|
+ AttachAction?.Invoke(this, foldPath);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ }
|
|
|
+ public enum ButtonPosition
|
|
|
+ {
|
|
|
+ Start,
|
|
|
+ End,
|
|
|
}
|
|
|
+
|
|
|
+ public class ButtonWidthConverter : IMultiValueConverter
|
|
|
+ {
|
|
|
+ public bool IsInverce { get; set; }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
|
|
|
+ {
|
|
|
+ var buttonPosition = (ButtonPosition)values[1];
|
|
|
+ double width = 0;
|
|
|
+ if (buttonPosition != ButtonPosition.Start)
|
|
|
+ {
|
|
|
+ width = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ return IsInverce ? values[0] : width;
|
|
|
+ }
|
|
|
+
|
|
|
+ public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
|
|
|
+ {
|
|
|
+ throw new NotImplementedException();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|