Skip to content

Commit

Permalink
Merge pull request #3247 from MahApps/feature/2.0_Remove_obsolete_code
Browse files Browse the repository at this point in the history
Remove obsolete marked code like properties and classes
  • Loading branch information
punker76 authored May 13, 2018
2 parents 10496fa + 75f974d commit 1f06068
Show file tree
Hide file tree
Showing 27 changed files with 77 additions and 910 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,15 @@
BasedOn="{StaticResource MahApps.Metro.Styles.ToggleSwitch}"
TargetType="{x:Type Controls:ToggleSwitch}">
<Setter Property="OffLabel" Value="False" />
<Setter Property="OffSwitchBrush" Value="Red" />
<Setter Property="OnLabel" Value="True" />
<Setter Property="SwitchForeground" Value="Red" />
<Setter Property="OnSwitchBrush" Value="Green" />
</Style>
<Style x:Key="CustomMetroToggleSwitchButton"
BasedOn="{StaticResource MahApps.Metro.Styles.ToggleSwitchButton}"
TargetType="{x:Type Controls:ToggleSwitchButton}">
<Setter Property="SwitchForeground" Value="YellowGreen" />
<Setter Property="OffSwitchBrush" Value="DarkRed" />
<Setter Property="OnSwitchBrush" Value="DarkGreen" />
</Style>
</StackPanel.Resources>
<Label Content="Toggle switch" Style="{DynamicResource DescriptionHeaderStyle}" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@
IsNavigationEnabled="{Binding ElementName=ShowNaviCheckBox, Path=IsChecked, Mode=OneWay}"
ItemTemplate="{StaticResource ImageDataTemplate}"
ItemsSource="{Binding FlipViewImages, Mode=OneWay}"
MouseOverGlowEnabled="{Binding ElementName=ShowMouseOverCheckBox, Path=IsChecked, Mode=OneWay}"
MouseHoverBorderEnabled="{Binding ElementName=ShowMouseOverCheckBox, Path=IsChecked, Mode=OneWay}"
Orientation="{Binding ElementName=Orientation, Path=SelectedValue, Mode=OneWay}" />
<StackPanel HorizontalAlignment="Center"
DataContext="{Binding ElementName=FlipView2nd, Mode=OneWay}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
<UserControl.Resources>
<Thickness x:Key="ColumnMargin">10 5 10 5</Thickness>
<Thickness x:Key="ControlMargin">0 5 0 0</Thickness>

<ObjectDataProvider x:Key="NumericInputValues"
MethodName="GetValues"
ObjectType="{x:Type Controls:NumericInput}">
<ObjectDataProvider.MethodParameters>
<x:Type TypeName="Controls:NumericInput" />
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
</UserControl.Resources>

<AdornerDecorator>
Expand Down Expand Up @@ -262,23 +270,34 @@
Grid.IsSharedSizeScope="True">
<Label Content="NumericUpDown" Style="{DynamicResource DescriptionHeaderStyle}" />

<UniformGrid Columns="2">
<CheckBox x:Name="ReadOnlyCheck"
Margin="1"
Content="IsReadOnly" />
<CheckBox x:Name="HasDecimalsCheckBox"
<CheckBox x:Name="ReadOnlyCheck"
Margin="1"
Content="IsReadOnly" />
<CheckBox x:Name="HasDecimalsCheckBox"
Margin="1"
Content="HasDecimals"
IsChecked="True" />

<Grid Margin="{StaticResource ControlMargin}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" SharedSizeGroup="LabelCol" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Content="NumericInputMode" />
<ComboBox x:Name="NumericInputCheckBox"
Grid.Column="1"
Width="100"
Margin="1"
Content="HasDecimals"
IsChecked="True" />
</UniformGrid>
ItemsSource="{Binding Source={StaticResource NumericInputValues}}" />
</Grid>

<Label Content="Min=&quot;0&quot; Max=&quot;10&quot; TextAlignment=&quot;Left&quot;" />
<Controls:NumericUpDown x:Name="Test"
HasDecimals="{Binding ElementName=HasDecimalsCheckBox, Path=IsChecked, Mode=TwoWay}"
IsEnabled="False"
IsReadOnly="{Binding ElementName=ReadOnlyCheck, Path=IsChecked, Mode=TwoWay}"
Maximum="10"
Minimum="0"
NumericInputMode="{Binding ElementName=NumericInputCheckBox, Path=SelectedItem, Mode=TwoWay}"
TextAlignment="Left"
Value="5" />

Expand All @@ -289,33 +308,33 @@
IsChecked="True" />
<Controls:NumericUpDown Controls:TextBoxHelper.ClearTextButton="True"
ButtonsAlignment="Left"
HasDecimals="{Binding ElementName=HasDecimalsCheckBox, Path=IsChecked, Mode=TwoWay}"
Interval="5.5"
IsReadOnly="{Binding ElementName=ReadOnlyCheck, Path=IsChecked, Mode=TwoWay}"
IsTabStop="False"
NumericInputMode="{Binding ElementName=NumericInputCheckBox, Path=SelectedItem, Mode=TwoWay}"
SnapToMultipleOfInterval="{Binding ElementName=SnapToMultipleOfIntervalCheck, Path=IsChecked, Mode=TwoWay}"
Value="5" />

<Controls:NumericUpDown Margin="{StaticResource ControlMargin}"
Controls:TextBoxHelper.Watermark="No Speedup when long pressed"
HasDecimals="{Binding ElementName=HasDecimalsCheckBox, Path=IsChecked, Mode=TwoWay}"
IsReadOnly="{Binding ElementName=ReadOnlyCheck, Path=IsChecked, Mode=TwoWay}"
NumericInputMode="{Binding ElementName=NumericInputCheckBox, Path=SelectedItem, Mode=TwoWay}"
Speedup="false" />
<Controls:NumericUpDown Margin="{StaticResource ControlMargin}"
Controls:TextBoxHelper.UseFloatingWatermark="True"
Controls:TextBoxHelper.Watermark="Speedup when pressed after 1000ms"
Delay="1000"
HasDecimals="{Binding ElementName=HasDecimalsCheckBox, Path=IsChecked, Mode=TwoWay}"
IsReadOnly="{Binding ElementName=ReadOnlyCheck, Path=IsChecked, Mode=TwoWay}"
NumericInputMode="{Binding ElementName=NumericInputCheckBox, Path=SelectedItem, Mode=TwoWay}"
Speedup="true" />

<Label Margin="{StaticResource ControlMargin}"
Content="{Binding ElementName=test, Path=Value, Mode=OneWay}"
ContentStringFormat="StringFormat, Real Value = {0}" />
<Controls:NumericUpDown x:Name="test"
HasDecimals="{Binding ElementName=HasDecimalsCheckBox, Path=IsChecked, Mode=TwoWay}"
IsReadOnly="{Binding ElementName=ReadOnlyCheck, Path=IsChecked, Mode=TwoWay}"
Maximum="100"
NumericInputMode="{Binding ElementName=NumericInputCheckBox, Path=SelectedItem, Mode=TwoWay}"
StringFormat="pcs. {0:N2} pcs."
Value="5" />
<Grid Margin="{StaticResource ControlMargin}">
Expand Down Expand Up @@ -344,18 +363,18 @@
</Grid>
<Controls:NumericUpDown x:Name="StringFormatNumUpDown"
Margin="{StaticResource ControlMargin}"
HasDecimals="{Binding ElementName=HasDecimalsCheckBox, Path=IsChecked, Mode=TwoWay}"
Interval=".1"
IsReadOnly="{Binding ElementName=ReadOnlyCheck, Path=IsChecked, Mode=TwoWay}"
NumericInputMode="{Binding ElementName=NumericInputCheckBox, Path=SelectedItem, Mode=TwoWay}"
StringFormat="0,000.00"
Value="{Binding ElementName=test, Path=Value, Mode=TwoWay}" />

<Label Content="Select all on focus" />
<Controls:NumericUpDown Controls:TextBoxHelper.SelectAllOnFocus="True"
ButtonsAlignment="Left"
HasDecimals="{Binding ElementName=HasDecimalsCheckBox, Path=IsChecked, Mode=TwoWay}"
Interval="5"
IsReadOnly="{Binding ElementName=ReadOnlyCheck, Path=IsChecked, Mode=TwoWay}"
NumericInputMode="{Binding ElementName=NumericInputCheckBox, Path=SelectedItem, Mode=TwoWay}"
Value="500" />
</StackPanel>

Expand All @@ -364,9 +383,9 @@
Margin="{StaticResource ColumnMargin}">
<Label Content="HotKeyBox" Style="{DynamicResource DescriptionHeaderStyle}" />
<Controls:HotKeyBox Margin="{StaticResource ControlMargin}"
Controls:TextBoxHelper.Watermark="Enter hot key"
AreModifierKeysRequired="{Binding ElementName=ModifierKeysRequired, Path=IsChecked}"
HotKey="{Binding HotKey, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged, NotifyOnValidationError=True}"
Watermark="Enter hot key" />
HotKey="{Binding HotKey, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged, NotifyOnValidationError=True}" />
<TextBlock Margin="{StaticResource ControlMargin}"
Foreground="{DynamicResource DarkIdealForegroundDisabledBrush}"
Text="Try SHIFT+D to demonstrate validation" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#endif
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using MahApps.Metro.Controls;
using MahApps.Metro.Controls.Dialogs;
using MetroDemo.ExampleWindows;
Expand Down Expand Up @@ -440,8 +441,9 @@ private void MenuWindowWithShadowOnClick(object sender, RoutedEventArgs e)
{
var w = this.GetTestWindow();
w.Content = new TextBlock() { Text = "Window with drop shadow", FontSize = 28, FontWeight = FontWeights.Light, VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center };
// use this to test the obsolete under the hood code
w.EnableDWMDropShadow = true;
w.BorderThickness = new Thickness(0);
w.BorderBrush = null;
w.GlowBrush = Brushes.Black;
w.Show();
}

Expand Down
29 changes: 0 additions & 29 deletions src/MahApps.Metro/Actions/CloseTabItemAction.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Collections;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using MahApps.Metro.Controls;

Expand All @@ -13,34 +12,6 @@ public class CloseTabItemAction : CommandTriggerAction

private TabItem AssociatedTabItem => this.associatedTabItem ?? (this.associatedTabItem = this.AssociatedObject.TryFindParent<TabItem>());

[Obsolete("This property will be deleted in the next release.")]
public static readonly DependencyProperty TabControlProperty =
DependencyProperty.Register(nameof(TabControl),
typeof(TabControl),
typeof(CloseTabItemAction),
new PropertyMetadata(default(TabControl)));

[Obsolete("This property will be deleted in the next release.")]
public TabControl TabControl
{
get { return (TabControl)this.GetValue(TabControlProperty); }
set { this.SetValue(TabControlProperty, value); }
}

[Obsolete("This property will be deleted in the next release.")]
public static readonly DependencyProperty TabItemProperty =
DependencyProperty.Register(nameof(TabItem),
typeof(TabItem),
typeof(CloseTabItemAction),
new PropertyMetadata(default(TabItem)));

[Obsolete("This property will be deleted in the next release.")]
public TabItem TabItem
{
get { return (TabItem)this.GetValue(TabItemProperty); }
set { this.SetValue(TabItemProperty, value); }
}

protected override void Invoke(object parameter)
{
if (this.AssociatedObject == null || (this.AssociatedObject != null && !this.AssociatedObject.IsEnabled))
Expand Down
24 changes: 0 additions & 24 deletions src/MahApps.Metro/Actions/SetFlyoutOpenAction.cs

This file was deleted.

44 changes: 0 additions & 44 deletions src/MahApps.Metro/Controls/CloseCommand.cs

This file was deleted.

6 changes: 0 additions & 6 deletions src/MahApps.Metro/Controls/Dialogs/MetroDialogSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,5 @@ public MetroDialogSettings()
/// Gets or sets the text used for the second auxiliary button.
/// </summary>
public string SecondAuxiliaryButtonText { get; set; }

/// <summary>
/// If set, stops standard resource dictionaries being applied to the dialog.
/// </summary>
[Obsolete("This property will be deleted in the next release.")]
public bool SuppressDefaultResources { get; set; }
}
}
9 changes: 0 additions & 9 deletions src/MahApps.Metro/Controls/FlipView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -496,8 +496,6 @@ private static void ExecuteWhenLoaded(FlipView flipview, Action body)
public static readonly DependencyProperty DownTransitionProperty = DependencyProperty.Register("DownTransition", typeof(TransitionType), typeof(FlipView), new PropertyMetadata(TransitionType.Down));
public static readonly DependencyProperty LeftTransitionProperty = DependencyProperty.Register("LeftTransition", typeof(TransitionType), typeof(FlipView), new PropertyMetadata(TransitionType.LeftReplace));
public static readonly DependencyProperty RightTransitionProperty = DependencyProperty.Register("RightTransition", typeof(TransitionType), typeof(FlipView), new PropertyMetadata(TransitionType.RightReplace));
[Obsolete("This property will be deleted in the next release. You should use now MouseHoverBorderEnabled instead.")]
public static readonly DependencyProperty MouseOverGlowEnabledProperty = DependencyProperty.Register("MouseOverGlowEnabled", typeof(bool), typeof(FlipView), new PropertyMetadata(true, (o, e) => ((FlipView)o).SetCurrentValue(MouseHoverBorderEnabledProperty, (bool)e.NewValue)));
public static readonly DependencyProperty MouseHoverBorderEnabledProperty = DependencyProperty.Register("MouseHoverBorderEnabled", typeof(bool), typeof(FlipView), new PropertyMetadata(true));
public static readonly DependencyProperty MouseHoverBorderBrushProperty = DependencyProperty.Register("MouseHoverBorderBrush", typeof(Brush), typeof(FlipView), new PropertyMetadata(Brushes.LightGray));
public static readonly DependencyProperty MouseHoverBorderThicknessProperty = DependencyProperty.Register("MouseHoverBorderThickness", typeof(Thickness), typeof(FlipView), new PropertyMetadata(new Thickness(4)));
Expand Down Expand Up @@ -531,13 +529,6 @@ public TransitionType RightTransition
set { this.SetValue(RightTransitionProperty, value); }
}

[Obsolete("This property will be deleted in the next release. You should use now MouseHoverBorderEnabled instead.")]
public bool MouseOverGlowEnabled
{
get { return (bool)this.GetValue(MouseOverGlowEnabledProperty); }
set { this.SetValue(MouseOverGlowEnabledProperty, value); }
}

/// <summary>
/// Gets or sets a value indicating whether the border for mouse over state is enabled or not.
/// </summary>
Expand Down
Loading

0 comments on commit 1f06068

Please sign in to comment.