Skip to content

Commit

Permalink
chore: use nameof expression.
Browse files Browse the repository at this point in the history
  • Loading branch information
NaBian committed Oct 10, 2022
1 parent 3876444 commit c513f5c
Show file tree
Hide file tree
Showing 116 changed files with 507 additions and 507 deletions.
12 changes: 6 additions & 6 deletions src/Net_40/HandyControl_Net_40/Themes/Theme.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3428,42 +3428,42 @@
<Style BasedOn="{StaticResource LabelDefault}" TargetType="Label" />
<Style x:Key="LabelDefault.Small" BasedOn="{StaticResource LabelDefault}" TargetType="Label">
<Setter Property="Height" Value="20" />
<Setter Property="Padding" Value="6,1" />
<Setter Property="Padding" Value="6,0" />
</Style>
<Style x:Key="LabelPrimary" BasedOn="{StaticResource LabelBaseStyle}" TargetType="Label">
<Setter Property="Background" Value="{DynamicResource PrimaryBrush}" />
</Style>
<Style x:Key="LabelPrimary.Small" BasedOn="{StaticResource LabelPrimary}" TargetType="Label">
<Setter Property="Height" Value="20" />
<Setter Property="Padding" Value="6,1" />
<Setter Property="Padding" Value="6,0" />
</Style>
<Style x:Key="LabelSuccess" BasedOn="{StaticResource LabelBaseStyle}" TargetType="Label">
<Setter Property="Background" Value="{DynamicResource SuccessBrush}" />
</Style>
<Style x:Key="LabelSuccess.Small" BasedOn="{StaticResource LabelSuccess}" TargetType="Label">
<Setter Property="Height" Value="20" />
<Setter Property="Padding" Value="6,1" />
<Setter Property="Padding" Value="6,0" />
</Style>
<Style x:Key="LabelInfo" BasedOn="{StaticResource LabelBaseStyle}" TargetType="Label">
<Setter Property="Background" Value="{DynamicResource InfoBrush}" />
</Style>
<Style x:Key="LabelInfo.Small" BasedOn="{StaticResource LabelInfo}" TargetType="Label">
<Setter Property="Height" Value="20" />
<Setter Property="Padding" Value="6,1" />
<Setter Property="Padding" Value="6,0" />
</Style>
<Style x:Key="LabelWarning" BasedOn="{StaticResource LabelBaseStyle}" TargetType="Label">
<Setter Property="Background" Value="{DynamicResource WarningBrush}" />
</Style>
<Style x:Key="LabelWarning.Small" BasedOn="{StaticResource LabelWarning}" TargetType="Label">
<Setter Property="Height" Value="20" />
<Setter Property="Padding" Value="6,1" />
<Setter Property="Padding" Value="6,0" />
</Style>
<Style x:Key="LabelDanger" BasedOn="{StaticResource LabelBaseStyle}" TargetType="Label">
<Setter Property="Background" Value="{DynamicResource DangerBrush}" />
</Style>
<Style x:Key="LabelDanger.Small" BasedOn="{StaticResource LabelDanger}" TargetType="Label">
<Setter Property="Height" Value="20" />
<Setter Property="Padding" Value="6,1" />
<Setter Property="Padding" Value="6,0" />
</Style>
<Style BasedOn="{StaticResource CompareSliderBaseStyle}" TargetType="hc:CompareSlider" />
<Style BasedOn="{StaticResource PreviewSliderBaseStyle}" TargetType="hc:PreviewSlider" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public Avatar()
}

public static readonly DependencyProperty SourceProperty = DependencyProperty.Register(
"Source", typeof(BitmapFrame), typeof(Avatar), new PropertyMetadata(default(BitmapFrame)));
nameof(Source), typeof(BitmapFrame), typeof(Avatar), new PropertyMetadata(default(BitmapFrame)));

public BitmapFrame Source
{
Expand All @@ -20,7 +20,7 @@ public BitmapFrame Source
}

public static readonly DependencyProperty UserNameProperty = DependencyProperty.Register(
"DisplayName", typeof(string), typeof(Avatar), new PropertyMetadata(default(string)));
nameof(DisplayName), typeof(string), typeof(Avatar), new PropertyMetadata(default(string)));

public string DisplayName
{
Expand All @@ -29,7 +29,7 @@ public string DisplayName
}

public static readonly DependencyProperty LinkProperty = DependencyProperty.Register(
"Link", typeof(string), typeof(Avatar), new PropertyMetadata(default(string)));
nameof(Link), typeof(string), typeof(Avatar), new PropertyMetadata(default(string)));

public string Link
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public partial class GeometryItem
public GeometryItem() => InitializeComponent();

public static readonly DependencyProperty InfoProperty = DependencyProperty.Register(
"Info", typeof(GeometryItemModel), typeof(GeometryItem), new PropertyMetadata(default(GeometryItemModel)));
nameof(Info), typeof(GeometryItemModel), typeof(GeometryItem), new PropertyMetadata(default(GeometryItemModel)));

public GeometryItemModel Info
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace HandyControlDemo.UserControl;
public partial class ProgressButtonDemoCtl
{
public static readonly DependencyProperty ProgressProperty = DependencyProperty.Register(
"Progress", typeof(int), typeof(ProgressButtonDemoCtl), new PropertyMetadata(default(int)));
nameof(Progress), typeof(int), typeof(ProgressButtonDemoCtl), new PropertyMetadata(default(int)));

public int Progress
{
Expand All @@ -16,7 +16,7 @@ public int Progress
}

public static readonly DependencyProperty IsUploadingProperty = DependencyProperty.Register(
"IsUploading", typeof(bool), typeof(ProgressButtonDemoCtl), new PropertyMetadata(default(bool)));
nameof(IsUploading), typeof(bool), typeof(ProgressButtonDemoCtl), new PropertyMetadata(default(bool)));

public bool IsUploading
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public PropertyGridDemoCtl()
}

public static readonly DependencyProperty DemoModelProperty = DependencyProperty.Register(
"DemoModel", typeof(PropertyGridDemoModel), typeof(PropertyGridDemoCtl), new PropertyMetadata(default(PropertyGridDemoModel)));
nameof(DemoModel), typeof(PropertyGridDemoModel), typeof(PropertyGridDemoCtl), new PropertyMetadata(default(PropertyGridDemoModel)));

public PropertyGridDemoModel DemoModel
{
Expand Down
4 changes: 2 additions & 2 deletions src/Shared/HandyControlDemo_Shared/Window/AboutWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public AboutWindow()
}

public static readonly DependencyProperty CopyRightProperty = DependencyProperty.Register(
"CopyRight", typeof(string), typeof(AboutWindow), new PropertyMetadata(default(string)));
nameof(CopyRight), typeof(string), typeof(AboutWindow), new PropertyMetadata(default(string)));

public string CopyRight
{
Expand All @@ -24,7 +24,7 @@ public string CopyRight
}

public static readonly DependencyProperty VersionProperty = DependencyProperty.Register(
"Version", typeof(string), typeof(AboutWindow), new PropertyMetadata(default(string)));
nameof(Version), typeof(string), typeof(AboutWindow), new PropertyMetadata(default(string)));

public string Version
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public DialogDemoWindow()
}

public static readonly DependencyProperty DialogTokenProperty = DependencyProperty.Register(
"DialogToken", typeof(string), typeof(DialogDemoWindow), new PropertyMetadata(default(string)));
nameof(DialogToken), typeof(string), typeof(DialogDemoWindow), new PropertyMetadata(default(string)));

public string DialogToken
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public abstract class AdornerElement : Control, IDisposable
protected FrameworkElement ElementTarget { get; set; }

public static readonly DependencyProperty TargetProperty = DependencyProperty.Register(
"Target", typeof(FrameworkElement), typeof(AdornerElement), new PropertyMetadata(default(FrameworkElement), OnTargetChanged));
nameof(Target), typeof(FrameworkElement), typeof(AdornerElement), new PropertyMetadata(default(FrameworkElement), OnTargetChanged));

private static void OnTargetChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace HandyControl.Controls;
public class HeaderedSelectableItem : SelectableItem
{
public static readonly DependencyProperty HeaderProperty = DependencyProperty.Register(
"Header", typeof(object), typeof(HeaderedSelectableItem), new PropertyMetadata(default(object)));
nameof(Header), typeof(object), typeof(HeaderedSelectableItem), new PropertyMetadata(default(object)));

public object Header
{
Expand All @@ -14,7 +14,7 @@ public object Header
}

public static readonly DependencyProperty HeaderTemplateProperty = DependencyProperty.Register(
"HeaderTemplate", typeof(DataTemplate), typeof(HeaderedSelectableItem), new PropertyMetadata(default(DataTemplate)));
nameof(HeaderTemplate), typeof(DataTemplate), typeof(HeaderedSelectableItem), new PropertyMetadata(default(DataTemplate)));

public DataTemplate HeaderTemplate
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace HandyControl.Controls;
public class HeaderedSimpleItemsControl : SimpleItemsControl
{
public static readonly DependencyProperty HeaderProperty = DependencyProperty.Register(
"Header", typeof(object), typeof(HeaderedSimpleItemsControl), new PropertyMetadata(default(object)));
nameof(Header), typeof(object), typeof(HeaderedSimpleItemsControl), new PropertyMetadata(default(object)));

public object Header
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace HandyControl.Controls;
public class RegularItemsControl : SimpleItemsControl
{
public static readonly DependencyProperty ItemWidthProperty = DependencyProperty.Register(
"ItemWidth", typeof(double), typeof(RegularItemsControl), new PropertyMetadata(ValueBoxes.Double200Box));
nameof(ItemWidth), typeof(double), typeof(RegularItemsControl), new PropertyMetadata(ValueBoxes.Double200Box));

public double ItemWidth
{
Expand All @@ -21,7 +21,7 @@ public double ItemWidth
}

public static readonly DependencyProperty ItemHeightProperty = DependencyProperty.Register(
"ItemHeight", typeof(double), typeof(RegularItemsControl), new PropertyMetadata(ValueBoxes.Double200Box));
nameof(ItemHeight), typeof(double), typeof(RegularItemsControl), new PropertyMetadata(ValueBoxes.Double200Box));

public double ItemHeight
{
Expand All @@ -30,7 +30,7 @@ public double ItemHeight
}

public static readonly DependencyProperty ItemMarginProperty = DependencyProperty.Register(
"ItemMargin", typeof(Thickness), typeof(RegularItemsControl), new PropertyMetadata(default(Thickness)));
nameof(ItemMargin), typeof(Thickness), typeof(RegularItemsControl), new PropertyMetadata(default(Thickness)));

public Thickness ItemMargin
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
protected virtual void OnSelected(RoutedEventArgs e) => RaiseEvent(e);

public static readonly DependencyProperty IsSelectedProperty = DependencyProperty.Register(
"IsSelected", typeof(bool), typeof(SelectableItem), new PropertyMetadata(ValueBoxes.FalseBox));
nameof(IsSelected), typeof(bool), typeof(SelectableItem), new PropertyMetadata(ValueBoxes.FalseBox));

public bool IsSelected
{
Expand All @@ -71,7 +71,7 @@ public bool IsSelected
}

public static readonly DependencyProperty SelfManageProperty = DependencyProperty.Register(
"SelfManage", typeof(bool), typeof(SelectableItem), new PropertyMetadata(ValueBoxes.FalseBox));
nameof(SelfManage), typeof(bool), typeof(SelectableItem), new PropertyMetadata(ValueBoxes.FalseBox));

public bool SelfManage
{
Expand All @@ -80,7 +80,7 @@ public bool SelfManage
}

public static readonly DependencyProperty CanDeselectProperty = DependencyProperty.Register(
"CanDeselect", typeof(bool), typeof(SelectableItem), new PropertyMetadata(ValueBoxes.FalseBox));
nameof(CanDeselect), typeof(bool), typeof(SelectableItem), new PropertyMetadata(ValueBoxes.FalseBox));

public bool CanDeselect
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ public class SimpleItemsControl : Control
private const string ElementPanel = "PART_Panel";

public static readonly DependencyProperty ItemTemplateProperty = DependencyProperty.Register(
"ItemTemplate", typeof(DataTemplate), typeof(SimpleItemsControl),
nameof(ItemTemplate), typeof(DataTemplate), typeof(SimpleItemsControl),
new FrameworkPropertyMetadata(default(DataTemplate), OnItemTemplateChanged));

public static readonly DependencyProperty ItemContainerStyleProperty = DependencyProperty.Register(
"ItemContainerStyle", typeof(Style), typeof(SimpleItemsControl),
nameof(ItemContainerStyle), typeof(Style), typeof(SimpleItemsControl),
new PropertyMetadata(default(Style), OnItemContainerStyleChanged));

public static readonly DependencyProperty ItemsSourceProperty = DependencyProperty.Register(
"ItemsSource", typeof(IEnumerable), typeof(SimpleItemsControl),
nameof(ItemsSource), typeof(IEnumerable), typeof(SimpleItemsControl),
new PropertyMetadata(default(IEnumerable), OnItemsSourceChanged));

public SimpleItemsControl()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo)
private void ElementPanel_SizeChanged(object sender, SizeChangedEventArgs e) => UpdateContent();

public static readonly DependencyProperty RunawayProperty = DependencyProperty.Register(
"Runaway", typeof(bool), typeof(RunningBlock), new FrameworkPropertyMetadata(ValueBoxes.TrueBox, FrameworkPropertyMetadataOptions.AffectsRender));
nameof(Runaway), typeof(bool), typeof(RunningBlock), new FrameworkPropertyMetadata(ValueBoxes.TrueBox, FrameworkPropertyMetadataOptions.AffectsRender));

public bool Runaway
{
Expand All @@ -59,7 +59,7 @@ public bool Runaway
}

public static readonly DependencyProperty AutoRunProperty = DependencyProperty.Register(
"AutoRun", typeof(bool), typeof(RunningBlock), new FrameworkPropertyMetadata(ValueBoxes.FalseBox, FrameworkPropertyMetadataOptions.AffectsRender));
nameof(AutoRun), typeof(bool), typeof(RunningBlock), new FrameworkPropertyMetadata(ValueBoxes.FalseBox, FrameworkPropertyMetadataOptions.AffectsRender));

public bool AutoRun
{
Expand All @@ -68,7 +68,7 @@ public bool AutoRun
}

public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register(
"Orientation", typeof(Orientation), typeof(RunningBlock), new FrameworkPropertyMetadata(default(Orientation), FrameworkPropertyMetadataOptions.AffectsRender));
nameof(Orientation), typeof(Orientation), typeof(RunningBlock), new FrameworkPropertyMetadata(default(Orientation), FrameworkPropertyMetadataOptions.AffectsRender));

public Orientation Orientation
{
Expand All @@ -77,7 +77,7 @@ public Orientation Orientation
}

public static readonly DependencyProperty DurationProperty = DependencyProperty.Register(
"Duration", typeof(Duration), typeof(RunningBlock), new FrameworkPropertyMetadata(new Duration(TimeSpan.FromSeconds(5)), FrameworkPropertyMetadataOptions.AffectsRender));
nameof(Duration), typeof(Duration), typeof(RunningBlock), new FrameworkPropertyMetadata(new Duration(TimeSpan.FromSeconds(5)), FrameworkPropertyMetadataOptions.AffectsRender));

public Duration Duration
{
Expand All @@ -86,7 +86,7 @@ public Duration Duration
}

public static readonly DependencyProperty SpeedProperty = DependencyProperty.Register(
"Speed", typeof(double), typeof(RunningBlock), new FrameworkPropertyMetadata(double.NaN, FrameworkPropertyMetadataOptions.AffectsRender));
nameof(Speed), typeof(double), typeof(RunningBlock), new FrameworkPropertyMetadata(double.NaN, FrameworkPropertyMetadataOptions.AffectsRender));

public double Speed
{
Expand All @@ -95,7 +95,7 @@ public double Speed
}

public static readonly DependencyProperty IsRunningProperty = DependencyProperty.Register(
"IsRunning", typeof(bool), typeof(RunningBlock), new PropertyMetadata(ValueBoxes.TrueBox, (o, args) =>
nameof(IsRunning), typeof(bool), typeof(RunningBlock), new PropertyMetadata(ValueBoxes.TrueBox, (o, args) =>
{
var ctl = (RunningBlock) o;
var v = (bool) args.NewValue;
Expand All @@ -116,7 +116,7 @@ public bool IsRunning
}

public static readonly DependencyProperty AutoReverseProperty = DependencyProperty.Register(
"AutoReverse", typeof(bool), typeof(RunningBlock), new FrameworkPropertyMetadata(ValueBoxes.FalseBox, FrameworkPropertyMetadataOptions.AffectsRender));
nameof(AutoReverse), typeof(bool), typeof(RunningBlock), new FrameworkPropertyMetadata(ValueBoxes.FalseBox, FrameworkPropertyMetadataOptions.AffectsRender));

public bool AutoReverse
{
Expand Down
8 changes: 4 additions & 4 deletions src/Shared/HandyControl_Shared/Controls/Block/ToggleBlock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace HandyControl.Controls;
public class ToggleBlock : Control
{
public static readonly DependencyProperty IsCheckedProperty = DependencyProperty.Register(
"IsChecked", typeof(bool?), typeof(ToggleBlock), new FrameworkPropertyMetadata(ValueBoxes.FalseBox,
nameof(IsChecked), typeof(bool?), typeof(ToggleBlock), new FrameworkPropertyMetadata(ValueBoxes.FalseBox,
FrameworkPropertyMetadataOptions.BindsTwoWayByDefault | FrameworkPropertyMetadataOptions.Journal));

[Category("Appearance")]
Expand All @@ -30,7 +30,7 @@ public bool? IsChecked
}

public static readonly DependencyProperty CheckedContentProperty = DependencyProperty.Register(
"CheckedContent", typeof(object), typeof(ToggleBlock), new PropertyMetadata(default(object)));
nameof(CheckedContent), typeof(object), typeof(ToggleBlock), new PropertyMetadata(default(object)));

public object CheckedContent
{
Expand All @@ -39,7 +39,7 @@ public object CheckedContent
}

public static readonly DependencyProperty UnCheckedContentProperty = DependencyProperty.Register(
"UnCheckedContent", typeof(object), typeof(ToggleBlock), new PropertyMetadata(default(object)));
nameof(UnCheckedContent), typeof(object), typeof(ToggleBlock), new PropertyMetadata(default(object)));

public object UnCheckedContent
{
Expand All @@ -48,7 +48,7 @@ public object UnCheckedContent
}

public static readonly DependencyProperty IndeterminateContentProperty = DependencyProperty.Register(
"IndeterminateContent", typeof(object), typeof(ToggleBlock), new PropertyMetadata(default(object)));
nameof(IndeterminateContent), typeof(object), typeof(ToggleBlock), new PropertyMetadata(default(object)));

public object IndeterminateContent
{
Expand Down
4 changes: 2 additions & 2 deletions src/Shared/HandyControl_Shared/Controls/Button/ButtonGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class ButtonGroup : ItemsControl
protected override bool IsItemItsOwnContainerOverride(object item) => item is Button or RadioButton or ToggleButton;

public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register(
"Orientation", typeof(Orientation), typeof(ButtonGroup), new PropertyMetadata(default(Orientation)));
nameof(Orientation), typeof(Orientation), typeof(ButtonGroup), new PropertyMetadata(default(Orientation)));

public Orientation Orientation
{
Expand All @@ -20,7 +20,7 @@ public Orientation Orientation
}

public static readonly DependencyProperty LayoutProperty = DependencyProperty.Register(
"Layout", typeof(LinearLayout), typeof(ButtonGroup), new PropertyMetadata(LinearLayout.Uniform));
nameof(Layout), typeof(LinearLayout), typeof(ButtonGroup), new PropertyMetadata(LinearLayout.Uniform));

public LinearLayout Layout
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace HandyControl.Controls;
public class ProgressButton : ToggleButton
{
public static readonly DependencyProperty ProgressStyleProperty = DependencyProperty.Register(
"ProgressStyle", typeof(Style), typeof(ProgressButton), new PropertyMetadata(default(Style)));
nameof(ProgressStyle), typeof(Style), typeof(ProgressButton), new PropertyMetadata(default(Style)));

public Style ProgressStyle
{
Expand All @@ -16,7 +16,7 @@ public Style ProgressStyle
}

public static readonly DependencyProperty ProgressProperty = DependencyProperty.Register(
"Progress", typeof(double), typeof(ProgressButton), new PropertyMetadata(ValueBoxes.Double0Box));
nameof(Progress), typeof(double), typeof(ProgressButton), new PropertyMetadata(ValueBoxes.Double0Box));

public double Progress
{
Expand Down
Loading

0 comments on commit c513f5c

Please sign in to comment.