-
-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
92 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using iNKORE.UI.WPF.Modern.Common.IconKeys; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
|
||
namespace iNKORE.UI.WPF.Modern.Controls | ||
{ | ||
public class IconAndText : ContentControl | ||
{ | ||
static IconAndText() | ||
{ | ||
DefaultStyleKeyProperty.OverrideMetadata(typeof(IconAndText), new FrameworkPropertyMetadata(typeof(IconAndText))); | ||
} | ||
|
||
#region Properties | ||
|
||
public static readonly DependencyProperty IconProperty = FontIcon.IconProperty.AddOwner(typeof(IconAndText)); | ||
public FontIconData? Icon | ||
{ | ||
get { return (FontIconData?)GetValue(IconProperty); } | ||
set { SetValue(IconProperty, value); } | ||
} | ||
|
||
public static readonly DependencyProperty SpacingProperty = SimpleStackPanel.SpacingProperty.AddOwner(typeof(IconAndText), new PropertyMetadata(6d)); | ||
public double Spacing | ||
{ | ||
get { return (double)GetValue(SpacingProperty); } | ||
set { SetValue(SpacingProperty, value); } | ||
} | ||
|
||
public static readonly DependencyProperty OrientationProperty = SimpleStackPanel.OrientationProperty.AddOwner(typeof(IconAndText), new PropertyMetadata(Orientation.Horizontal)); | ||
public Orientation Orientation | ||
{ | ||
get { return (Orientation)GetValue(OrientationProperty); } | ||
set { SetValue(OrientationProperty, value); } | ||
} | ||
|
||
#endregion | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:local="clr-namespace:iNKORE.UI.WPF.Modern.Controls" | ||
xmlns:ch="clr-namespace:iNKORE.UI.WPF.Modern.Controls.Helpers" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> | ||
|
||
<Style TargetType="local:IconAndText"> | ||
<Setter Property="HorizontalAlignment" Value="Center"/> | ||
<Setter Property="VerticalAlignment" Value="Center"/> | ||
<Setter Property="Template"> | ||
<Setter.Value> | ||
<ControlTemplate TargetType="local:IconAndText"> | ||
<Border x:Name="Root" Background="{TemplateBinding Background}" | ||
BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" | ||
CornerRadius="{TemplateBinding ch:ControlHelper.CornerRadius}"> | ||
<local:SimpleStackPanel x:Name="RootLayout" Orientation="{TemplateBinding Orientation}" Spacing="{TemplateBinding Spacing}" | ||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"> | ||
|
||
<local:FontIcon x:Name="Icon" Icon="{TemplateBinding Icon}" | ||
FontSize="{TemplateBinding FontSize}" FontWeight="{TemplateBinding FontWeight}" FontStyle="{TemplateBinding FontStyle}" | ||
HorizontalAlignment="Center" VerticalAlignment="Center"/> | ||
<local:ContentPresenterEx x:Name="ContentPresenter" Content="{TemplateBinding Content}" | ||
HorizontalAlignment="Center" VerticalAlignment="Center"/> | ||
|
||
</local:SimpleStackPanel> | ||
</Border> | ||
|
||
<ControlTemplate.Triggers> | ||
|
||
<Trigger Property="Icon" Value="{x:Null}"> | ||
<Setter TargetName="RootLayout" Property="Spacing" Value="0"/> | ||
</Trigger> | ||
<Trigger Property="Content" Value="{x:Null}"> | ||
<Setter TargetName="RootLayout" Property="Spacing" Value="0"/> | ||
</Trigger> | ||
|
||
</ControlTemplate.Triggers> | ||
</ControlTemplate> | ||
</Setter.Value> | ||
</Setter> | ||
</Style> | ||
|
||
</ResourceDictionary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters