Some cleanup in Card and ExCard controls

This commit is contained in:
Yusyuriv 2024-04-21 19:37:24 +06:00
parent 5cd8fa9d0b
commit 2741485985
No known key found for this signature in database
GPG key ID: A91C52E6F73148E0
2 changed files with 20 additions and 41 deletions

View file

@ -1,25 +1,16 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
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.Forms;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows;
using UserControl = System.Windows.Controls.UserControl;
namespace Flow.Launcher.Resources.Controls
{
public partial class Card : UserControl
{
public enum CardType
{
Inside,
InsideFit
}
public Card()
{
InitializeComponent();
@ -30,7 +21,7 @@ namespace Flow.Launcher.Resources.Controls
set { SetValue(TitleValueProperty, value); }
}
public static readonly DependencyProperty TitleValueProperty =
DependencyProperty.Register("Title", typeof(string), typeof(Card), new PropertyMetadata(string.Empty));
DependencyProperty.Register(nameof(Title), typeof(string), typeof(Card), new PropertyMetadata(string.Empty));
public string Sub
{
@ -38,7 +29,7 @@ namespace Flow.Launcher.Resources.Controls
set { SetValue(SubValueProperty, value); }
}
public static readonly DependencyProperty SubValueProperty =
DependencyProperty.Register("Sub", typeof(string), typeof(Card), new PropertyMetadata(string.Empty));
DependencyProperty.Register(nameof(Sub), typeof(string), typeof(Card), new PropertyMetadata(string.Empty));
public string Icon
{
@ -46,7 +37,7 @@ namespace Flow.Launcher.Resources.Controls
set { SetValue(IconValueProperty, value); }
}
public static readonly DependencyProperty IconValueProperty =
DependencyProperty.Register("Icon", typeof(string), typeof(Card), new PropertyMetadata(string.Empty));
DependencyProperty.Register(nameof(Icon), typeof(string), typeof(Card), new PropertyMetadata(string.Empty));
/// <summary>
/// Gets or sets additional content for the UserControl
@ -57,15 +48,15 @@ namespace Flow.Launcher.Resources.Controls
set { SetValue(AdditionalContentProperty, value); }
}
public static readonly DependencyProperty AdditionalContentProperty =
DependencyProperty.Register("AdditionalContent", typeof(object), typeof(Card),
DependencyProperty.Register(nameof(AdditionalContent), typeof(object), typeof(Card),
new PropertyMetadata(null));
public object Type
public CardType Type
{
get { return (object)GetValue(TypeProperty); }
get { return (CardType)GetValue(TypeProperty); }
set { SetValue(TypeProperty, value); }
}
public static readonly DependencyProperty TypeProperty =
DependencyProperty.Register("Type", typeof(object), typeof(Card),
DependencyProperty.Register(nameof(Type), typeof(CardType), typeof(Card),
new PropertyMetadata(null));
}
}

View file

@ -1,17 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
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 Flow.Launcher.Resources.Controls
{
@ -27,7 +15,7 @@ namespace Flow.Launcher.Resources.Controls
set { SetValue(TitleValueProperty, value); }
}
public static readonly DependencyProperty TitleValueProperty =
DependencyProperty.Register("Title", typeof(string), typeof(ExCard), new PropertyMetadata(string.Empty));
DependencyProperty.Register(nameof(Title), typeof(string), typeof(ExCard), new PropertyMetadata(string.Empty));
public string Sub
{
@ -35,7 +23,7 @@ namespace Flow.Launcher.Resources.Controls
set { SetValue(SubValueProperty, value); }
}
public static readonly DependencyProperty SubValueProperty =
DependencyProperty.Register("Sub", typeof(string), typeof(ExCard), new PropertyMetadata(string.Empty));
DependencyProperty.Register(nameof(Sub), typeof(string), typeof(ExCard), new PropertyMetadata(string.Empty));
public string Icon
{
@ -43,7 +31,7 @@ namespace Flow.Launcher.Resources.Controls
set { SetValue(IconValueProperty, value); }
}
public static readonly DependencyProperty IconValueProperty =
DependencyProperty.Register("Icon", typeof(string), typeof(ExCard), new PropertyMetadata(string.Empty));
DependencyProperty.Register(nameof(Icon), typeof(string), typeof(ExCard), new PropertyMetadata(string.Empty));
/// <summary>
/// Gets or sets additional content for the UserControl
@ -54,7 +42,7 @@ namespace Flow.Launcher.Resources.Controls
set { SetValue(AdditionalContentProperty, value); }
}
public static readonly DependencyProperty AdditionalContentProperty =
DependencyProperty.Register("AdditionalContent", typeof(object), typeof(ExCard),
DependencyProperty.Register(nameof(AdditionalContent), typeof(object), typeof(ExCard),
new PropertyMetadata(null));
public object SideContent
@ -63,7 +51,7 @@ namespace Flow.Launcher.Resources.Controls
set { SetValue(SideContentProperty, value); }
}
public static readonly DependencyProperty SideContentProperty =
DependencyProperty.Register("SideContent", typeof(object), typeof(ExCard),
DependencyProperty.Register(nameof(SideContent), typeof(object), typeof(ExCard),
new PropertyMetadata(null));
}
}