180 lines
6.6 KiB
C#
180 lines
6.6 KiB
C#
using AuroraUIComponent.UserControls.KeyValueBase;
|
|
using Hermes.Functional;
|
|
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 AuroraUIComponent.UserControls {
|
|
/// <summary>
|
|
/// Interaction logic for UCKeyContentView.xaml
|
|
/// </summary>
|
|
public partial class UCKeyContentView : UCKeyValueBase {
|
|
public UCKeyContentView() {
|
|
InitializeComponent();
|
|
}
|
|
public static readonly DependencyProperty ContentViewProperty
|
|
= DependencyProperty.Register(
|
|
nameof(ContentView),
|
|
typeof(object),
|
|
typeof(UCKeyContentView),
|
|
new FrameworkPropertyMetadata(
|
|
null,
|
|
FrameworkPropertyMetadataOptions.BindsTwoWayByDefault
|
|
));
|
|
|
|
public object ContentView {
|
|
get { return (object)GetValue(ContentViewProperty); }
|
|
set { SetValue(ContentViewProperty, value); }
|
|
}
|
|
|
|
public static readonly DependencyProperty IsShowHelperProperty
|
|
= DependencyProperty.Register(
|
|
nameof(IsShowHelper),
|
|
typeof(bool),
|
|
typeof(UCKeyContentView),
|
|
new FrameworkPropertyMetadata(
|
|
false,
|
|
FrameworkPropertyMetadataOptions.BindsTwoWayByDefault
|
|
));
|
|
|
|
public bool IsShowHelper {
|
|
get { return (bool)GetValue(IsShowHelperProperty); }
|
|
set { SetValue(IsShowHelperProperty, value); }
|
|
}
|
|
|
|
public static readonly DependencyProperty ValueVerticalAlignmentProperty
|
|
= DependencyProperty.Register(
|
|
nameof(ValueVerticalAlignment),
|
|
typeof(VerticalAlignment),
|
|
typeof(UCKeyContentView),
|
|
new PropertyMetadata(VerticalAlignment.Center));
|
|
|
|
public VerticalAlignment ValueVerticalAlignment {
|
|
get { return (VerticalAlignment)GetValue(ValueVerticalAlignmentProperty); }
|
|
set { SetValue(ValueVerticalAlignmentProperty, value); }
|
|
}
|
|
|
|
public static readonly DependencyProperty IsFoldingProperty
|
|
= DependencyProperty.Register(
|
|
nameof(IsFolding),
|
|
typeof(bool),
|
|
typeof(UCKeyContentView), new FrameworkPropertyMetadata(
|
|
false,
|
|
FrameworkPropertyMetadataOptions.BindsTwoWayByDefault
|
|
));
|
|
|
|
public bool IsFolding {
|
|
get { return (bool)GetValue(IsFoldingProperty); }
|
|
set {
|
|
//if(IsFolding != value && UseFoldingButton) { TextValue.Visibility = value ? Visibility.Collapsed : Visibility.Visible; }
|
|
if (UseFoldingButton) {
|
|
if((bool)GetValue(IsFoldingProperty) != value) {
|
|
SetValue(IsFoldingProperty, value);
|
|
if(FoldingChangedEvent != null) {
|
|
FoldingChangedEvent(this, new RoutedEventArgs());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private event RoutedEventHandler FoldingChangedEvent; // Binding 한 IsFolding Property changed event
|
|
public static readonly DependencyProperty UseFoldingButtonProperty
|
|
= DependencyProperty.Register(
|
|
nameof(UseFoldingButton),
|
|
typeof(bool),
|
|
typeof(UCKeyContentView),
|
|
new FrameworkPropertyMetadata(
|
|
true,
|
|
FrameworkPropertyMetadataOptions.BindsTwoWayByDefault
|
|
));
|
|
|
|
public bool UseFoldingButton {
|
|
get { return (bool)GetValue(UseFoldingButtonProperty); }
|
|
set { SetValue(UseFoldingButtonProperty, value); }
|
|
}
|
|
|
|
|
|
public static readonly DependencyProperty FoldingBtnStyleProperty
|
|
= DependencyProperty.Register(
|
|
nameof(FoldingBtnStyle),
|
|
typeof(Style),
|
|
typeof(UCKeyContentView),
|
|
new PropertyMetadata(null));
|
|
|
|
public Style FoldingBtnStyle {
|
|
get { return (Style)GetValue(FoldingBtnStyleProperty); }
|
|
set { SetValue(FoldingBtnStyleProperty, value); }
|
|
}
|
|
|
|
public static readonly DependencyProperty FoldingBtnMarginProperty
|
|
= DependencyProperty.Register(
|
|
nameof(FoldingBtnMargin),
|
|
typeof(Thickness),
|
|
typeof(UCKeyContentView),
|
|
new FrameworkPropertyMetadata(
|
|
new Thickness(0),
|
|
FrameworkPropertyMetadataOptions.BindsTwoWayByDefault
|
|
));
|
|
|
|
public Thickness FoldingBtnMargin {
|
|
get { return (Thickness)GetValue(FoldingBtnMarginProperty); }
|
|
set { SetValue(FoldingBtnMarginProperty, value); }
|
|
}
|
|
|
|
public static readonly DependencyProperty FoldingBtnWidthProperty
|
|
= DependencyProperty.Register(
|
|
nameof(FoldingBtnWidth),
|
|
typeof(double),
|
|
typeof(UCKeyContentView),
|
|
new FrameworkPropertyMetadata(
|
|
10.0,
|
|
FrameworkPropertyMetadataOptions.BindsTwoWayByDefault
|
|
));
|
|
public double FoldingBtnWidth {
|
|
get { return (double)GetValue(FoldingBtnWidthProperty); }
|
|
set { SetValue(FoldingBtnWidthProperty, value); }
|
|
}
|
|
|
|
public static readonly DependencyProperty FoldingBtnHeightProperty
|
|
= DependencyProperty.Register(
|
|
nameof(FoldingBtnHeight),
|
|
typeof(double),
|
|
typeof(UCKeyContentView),
|
|
new FrameworkPropertyMetadata(
|
|
10.0,
|
|
FrameworkPropertyMetadataOptions.BindsTwoWayByDefault
|
|
));
|
|
public double FoldingBtnHeight {
|
|
get { return (double)GetValue(FoldingBtnHeightProperty); }
|
|
set { SetValue(FoldingBtnHeightProperty, value); }
|
|
}
|
|
|
|
|
|
protected override void KeyTextChanged(string newValue) {
|
|
|
|
}
|
|
|
|
public void ChangeFold(bool fold) {
|
|
IsFolding = fold;
|
|
}
|
|
|
|
public void SetFoldingChangedEventHandler(RoutedEventHandler eventHandler) {
|
|
MainToggleButton.Click += eventHandler;
|
|
FoldingChangedEvent += eventHandler;
|
|
}
|
|
|
|
}
|
|
}
|