Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved attached properties related to Header under HeaderedControlHelper #3697

Merged
merged 2 commits into from
Nov 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<Style BasedOn="{StaticResource MahApps.Styles.Slider.Win10}" TargetType="{x:Type Slider}" />

<Style BasedOn="{StaticResource {x:Type Controls:MetroHeader}}" TargetType="{x:Type Controls:MetroHeader}">
<Setter Property="Controls:ControlsHelper.HeaderMargin" Value="0 0 0 5" />
<Setter Property="Controls:HeaderedControlHelper.HeaderMargin" Value="0 0 0 5" />
<Setter Property="FontSize" Value="15" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@
<ContentControl DataContext="{Binding ElementName=DefaultTabControl}" Template="{StaticResource TabControlConfigDataTemplate}" />
<TabControl x:Name="DefaultTabControl"
Height="200"
Controls:ControlsHelper.HeaderFontFamily="Segoe Script"
Controls:ControlsHelper.HeaderFontSize="18">
Controls:HeaderedControlHelper.HeaderFontFamily="Segoe Script"
Controls:HeaderedControlHelper.HeaderFontSize="18">
<TabItem Header="Item _1">
<TextBlock FontSize="30" Text="Content" />
</TabItem>
Expand Down Expand Up @@ -294,41 +294,41 @@
Style="{DynamicResource DescriptionHeaderStyle}" />
<ContentControl DataContext="{Binding ElementName=MetroTabControlClosable}" Template="{StaticResource MetroTabControlConfigDataTemplate}" />
<Controls:MetroTabControl x:Name="MetroTabControlClosable" TabItemClosingEvent="MetroTabControl_TabItemClosingEvent">
<Controls:MetroTabItem Controls:ControlsHelper.HeaderFontSize="20"
<Controls:MetroTabItem Controls:HeaderedControlHelper.HeaderFontSize="20"
CloseButtonEnabled="True"
CloseTabCommand="{Binding SingleCloseTabCommand}"
CloseTabCommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Header}"
Header="headers">
<TextBlock FontSize="30" Text="you can bind to a command" />
</Controls:MetroTabItem>
<Controls:MetroTabItem Controls:ControlsHelper.HeaderFontSize="22"
<Controls:MetroTabItem Controls:HeaderedControlHelper.HeaderFontSize="22"
CloseButtonEnabled="True"
CloseTabCommand="{Binding NeverCloseTabCommand}"
CloseTabCommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Header}"
Header="can">
<TextBlock FontSize="30" Text="and ensure the command never closes" />
</Controls:MetroTabItem>
<Controls:MetroTabItem Controls:ControlsHelper.HeaderFontSize="24"
<Controls:MetroTabItem Controls:HeaderedControlHelper.HeaderFontSize="24"
CloseButtonEnabled="True"
Header="have">
<TextBlock FontSize="30" Text="More more content" />
</Controls:MetroTabItem>
<Controls:MetroTabItem Controls:ControlsHelper.HeaderFontSize="26"
<Controls:MetroTabItem Controls:HeaderedControlHelper.HeaderFontSize="26"
CloseButtonEnabled="True"
Header="different">
<TextBlock FontSize="30" Text="So much content!" />
</Controls:MetroTabItem>
<Controls:MetroTabItem Controls:ControlsHelper.HeaderFontSize="28"
<Controls:MetroTabItem Controls:HeaderedControlHelper.HeaderFontSize="28"
CloseButtonEnabled="True"
Header="font">
<TextBlock FontSize="30" Text="Content!" />
</Controls:MetroTabItem>
<Controls:MetroTabItem Controls:ControlsHelper.HeaderFontSize="30"
<Controls:MetroTabItem Controls:HeaderedControlHelper.HeaderFontSize="30"
CloseButtonEnabled="True"
Header="sizes">
<TextBlock FontSize="30" Text="This is not content (it is). This one won't close." />
</Controls:MetroTabItem>
<Controls:MetroTabItem Controls:ControlsHelper.HeaderFontSize="36"
<Controls:MetroTabItem Controls:HeaderedControlHelper.HeaderFontSize="36"
CloseButtonEnabled="True"
Header="close button">
<TextBlock FontSize="24" Text="The size of close button will be changed proportionately considering its header size." />
Expand All @@ -342,29 +342,29 @@
<Controls:MetroTabControl x:Name="MetroTabControl"
Height="200"
KeepVisualTreeInMemoryWhenChangingTabs="True">
<Controls:MetroTabItem Controls:ControlsHelper.HeaderFontSize="18" Header="item _1">
<Controls:MetroTabItem Controls:HeaderedControlHelper.HeaderFontSize="18" Header="item _1">
<StackPanel Orientation="Horizontal">
<TextBlock FontSize="30" Text="Load-Count: " />
<TextBlock FontSize="30"
Loaded="TextBlock_OnLoaded"
Text="0" />
</StackPanel>
</Controls:MetroTabItem>
<Controls:MetroTabItem Controls:ControlsHelper.HeaderFontSize="18" Header="item _2 more">
<Controls:MetroTabItem Controls:HeaderedControlHelper.HeaderFontSize="18" Header="item _2 more">
<TextBlock FontSize="30" Text="More content" />
</Controls:MetroTabItem>
<Controls:MetroTabItem Controls:ControlsHelper.HeaderFontSize="18" Header="item _3 header here">
<Controls:MetroTabItem Controls:HeaderedControlHelper.HeaderFontSize="18" Header="item _3 header here">
<TextBlock FontSize="30" Text="More more content" />
</Controls:MetroTabItem>
<Controls:MetroTabItem Controls:ControlsHelper.HeaderFontSize="18" Header="item _4 ">
<Controls:MetroTabItem Controls:HeaderedControlHelper.HeaderFontSize="18" Header="item _4 ">
<TextBlock FontSize="30" Text="So much content!" />
</Controls:MetroTabItem>
<Controls:MetroTabItem Controls:ControlsHelper.HeaderFontSize="18"
<Controls:MetroTabItem Controls:HeaderedControlHelper.HeaderFontSize="18"
CloseButtonEnabled="True"
Header="item _5">
<TextBlock FontSize="30" Text="Content!" />
</Controls:MetroTabItem>
<Controls:MetroTabItem Controls:ControlsHelper.HeaderFontSize="18" Header="item _6">
<Controls:MetroTabItem Controls:HeaderedControlHelper.HeaderFontSize="18" Header="item _6">
<TextBlock FontSize="30" Text="This is not content (it is)" />
</Controls:MetroTabItem>
</Controls:MetroTabControl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@

<GroupBox Grid.Column="0"
Padding="5"
Controls:ControlsHelper.HeaderFontSize="30"
Controls:HeaderedControlHelper.HeaderFontSize="30"
Header="artists">
<ListBox x:Name="artist"
ItemsSource="{x:Static models:SampleData.Artists}"
Expand Down Expand Up @@ -170,7 +170,7 @@

<GroupBox Grid.Column="2"
Padding="5"
Controls:ControlsHelper.HeaderFontSize="30"
Controls:HeaderedControlHelper.HeaderFontSize="30"
Header="some tests">
<StackPanel MinWidth="100"
HorizontalAlignment="Center"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
<Controls:Flyout x:Name="settingsFlyout"
Margin="200 30 0 0"
Controls:ControlsHelper.ContentCharacterCasing="Upper"
Controls:ControlsHelper.HeaderFontFamily="Segoe Script"
Controls:HeaderedControlHelper.HeaderFontFamily="Segoe Script"
AreAnimationsEnabled="True"
FocusedElement="{Binding ElementName=firstTB}"
Header="Settings"
Expand Down
83 changes: 0 additions & 83 deletions src/MahApps.Metro/Controls/Helper/ControlsHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Documents;
using System.Windows.Media;

namespace MahApps.Metro.Controls
Expand Down Expand Up @@ -67,89 +66,7 @@ public static void SetContentCharacterCasing(UIElement element, CharacterCasing
element.SetValue(ContentCharacterCasingProperty, value);
}

public static readonly DependencyProperty HeaderFontFamilyProperty =
DependencyProperty.RegisterAttached("HeaderFontFamily", typeof(FontFamily), typeof(ControlsHelper), new FrameworkPropertyMetadata(SystemFonts.MessageFontFamily));

[Category(AppName.MahApps)]
[AttachedPropertyBrowsableForType(typeof(HeaderedContentControl))]
[AttachedPropertyBrowsableForType(typeof(TabControl))]
[AttachedPropertyBrowsableForType(typeof(Flyout))]
public static FontFamily GetHeaderFontFamily(UIElement element)
{
return (FontFamily)element.GetValue(HeaderFontFamilyProperty);
}

public static void SetHeaderFontFamily(UIElement element, FontFamily value)
{
element.SetValue(HeaderFontFamilyProperty, value);
}

public static readonly DependencyProperty HeaderFontSizeProperty =
DependencyProperty.RegisterAttached("HeaderFontSize", typeof(double), typeof(ControlsHelper), new FrameworkPropertyMetadata(SystemFonts.MessageFontSize));

[Category(AppName.MahApps)]
[AttachedPropertyBrowsableForType(typeof(HeaderedContentControl))]
[AttachedPropertyBrowsableForType(typeof(TabControl))]
[AttachedPropertyBrowsableForType(typeof(Flyout))]
public static double GetHeaderFontSize(UIElement element)
{
return (double)element.GetValue(HeaderFontSizeProperty);
}

public static void SetHeaderFontSize(UIElement element, double value)
{
element.SetValue(HeaderFontSizeProperty, value);
}

public static readonly DependencyProperty HeaderFontStretchProperty =
DependencyProperty.RegisterAttached("HeaderFontStretch", typeof(FontStretch), typeof(ControlsHelper), new FrameworkPropertyMetadata(TextElement.FontStretchProperty.DefaultMetadata.DefaultValue));

[Category(AppName.MahApps)]
[AttachedPropertyBrowsableForType(typeof(HeaderedContentControl))]
[AttachedPropertyBrowsableForType(typeof(TabControl))]
[AttachedPropertyBrowsableForType(typeof(Flyout))]
public static FontStretch GetHeaderFontStretch(UIElement element)
{
return (FontStretch)element.GetValue(HeaderFontStretchProperty);
}

public static void SetHeaderFontStretch(UIElement element, FontStretch value)
{
element.SetValue(HeaderFontStretchProperty, value);
}

public static readonly DependencyProperty HeaderFontWeightProperty =
DependencyProperty.RegisterAttached("HeaderFontWeight", typeof(FontWeight), typeof(ControlsHelper), new FrameworkPropertyMetadata(SystemFonts.MessageFontWeight));

[Category(AppName.MahApps)]
[AttachedPropertyBrowsableForType(typeof(HeaderedContentControl))]
[AttachedPropertyBrowsableForType(typeof(TabControl))]
[AttachedPropertyBrowsableForType(typeof(Flyout))]
public static FontWeight GetHeaderFontWeight(UIElement element)
{
return (FontWeight)element.GetValue(HeaderFontWeightProperty);
}

public static void SetHeaderFontWeight(UIElement element, FontWeight value)
{
element.SetValue(HeaderFontWeightProperty, value);
}

public static readonly DependencyProperty HeaderMarginProperty =
DependencyProperty.RegisterAttached("HeaderMargin", typeof(Thickness), typeof(ControlsHelper), new UIPropertyMetadata(new Thickness()));

[Category(AppName.MahApps)]
[AttachedPropertyBrowsableForType(typeof(HeaderedContentControl))]
[AttachedPropertyBrowsableForType(typeof(Flyout))]
public static Thickness GetHeaderMargin(UIElement element)
{
return (Thickness)element.GetValue(HeaderMarginProperty);
}

public static void SetHeaderMargin(UIElement element, Thickness value)
{
element.SetValue(HeaderMarginProperty, value);
}

public static readonly DependencyProperty FocusBorderBrushProperty
= DependencyProperty.RegisterAttached("FocusBorderBrush",
Expand Down
Loading