Skip to content

Commit f61171c

Browse files
committed
Changes from review
1 parent f3652ba commit f61171c

File tree

8 files changed

+407
-504
lines changed

8 files changed

+407
-504
lines changed

src/MahApps.Metro.Samples/MahApps.Metro.Demo/ExampleViews/MultiSelectionComboBoxExample.xaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@
2424
</Style>
2525

2626
<!-- Selection Order -->
27-
<ObjectDataProvider x:Key="Demo.Enums.OrderSelectedItemsBy"
27+
<ObjectDataProvider x:Key="Demo.Enums.SelectedItemsOrderType"
2828
MethodName="GetValues"
29-
ObjectType="{x:Type system:Enum}">
29+
ObjectType="{x:Type mah:SelectedItemsOrderType}">
3030
<ObjectDataProvider.MethodParameters>
31-
<x:Type TypeName="mah:OrderSelectedItemsBy" />
31+
<x:Type TypeName="mah:SelectedItemsOrderType" />
3232
</ObjectDataProvider.MethodParameters>
3333
</ObjectDataProvider>
3434

@@ -146,7 +146,7 @@
146146
<ComboBox ItemsSource="{Binding Source={StaticResource Demo.Enums.SelectionMode}}" SelectedItem="{Binding ElementName=mscb_Example, Path=SelectionMode}" />
147147
</mah:MetroHeader>
148148
<mah:MetroHeader Header="OrderSelectedItemsBy">
149-
<ComboBox ItemsSource="{Binding Source={StaticResource Demo.Enums.OrderSelectedItemsBy}}" SelectedItem="{Binding ElementName=mscb_Example, Path=OrderSelectedItemsBy}" />
149+
<ComboBox ItemsSource="{Binding Source={StaticResource Demo.Enums.SelectedItemsOrderType}}" SelectedItem="{Binding ElementName=mscb_Example, Path=OrderSelectedItemsBy}" />
150150
</mah:MetroHeader>
151151
<mah:MetroHeader Header="ObjectToStringComparer">
152152
<ComboBox SelectedValue="{Binding ElementName=mscb_Example, Path=ObjectToStringComparer}" SelectedValuePath="Tag">

src/MahApps.Metro.Samples/MahApps.Metro.Demo/Models/Album.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using System;
66
using System.Collections.Generic;
77
using System.ComponentModel;
8-
using System.Globalization;
98
using System.Linq;
109
using MetroDemo.Core;
1110

src/MahApps.Metro.Samples/MahApps.Metro.Demo/Models/ObjectParser.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,7 @@
44

55
using MahApps.Metro.Controls;
66
using MahApps.Metro.Controls.Dialogs;
7-
using System;
8-
using System.Collections.Generic;
97
using System.Globalization;
10-
using System.Linq;
11-
using System.Text;
12-
using System.Threading.Tasks;
13-
using System.Windows;
148

159
namespace MetroDemo.Models
1610
{
@@ -39,7 +33,7 @@ public object CreateObjectFromString(string input, CultureInfo culture, string s
3933
DefaultButtonFocus = MessageDialogResult.Affirmative
4034
};
4135

42-
if (_dialogCoordinator.ShowModalMessageExternal(_mainWindowViewModel, "Add Animal", $"Do you want to add \"{input}\" to the animals list?", MessageDialogStyle.AffirmativeAndNegative, dialogSettings) == MessageDialogResult.Affirmative)
36+
if (this._dialogCoordinator.ShowModalMessageExternal(this._mainWindowViewModel, "Add Animal", $"Do you want to add \"{input}\" to the animals list?", MessageDialogStyle.AffirmativeAndNegative, dialogSettings) == MessageDialogResult.Affirmative)
4337
{
4438
return input.Trim();
4539
}

src/MahApps.Metro/Controls/Helper/BindingHelper.cs

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@ public static class BindingHelper
1616
/// <summary>
1717
/// A dummy property to initialize the binding to evaluate
1818
/// </summary>
19-
private static readonly DependencyProperty DummyProperty = DependencyProperty.RegisterAttached(
20-
"Dummy",
21-
typeof(object),
22-
typeof(BindingHelper),
23-
new UIPropertyMetadata(null));
19+
private static readonly DependencyProperty DummyProperty
20+
= DependencyProperty.RegisterAttached("Dummy",
21+
typeof(object),
22+
typeof(BindingHelper),
23+
new UIPropertyMetadata(null));
2424

2525
/// <summary>
2626
/// A dummy property to initialize the binding to evaluate. This property supports also string format.
2727
/// </summary>
28-
private static readonly DependencyProperty DummyTextProperty = DependencyProperty.RegisterAttached(
29-
"DummyText",
30-
typeof(string),
31-
typeof(BindingHelper),
32-
new UIPropertyMetadata(null));
28+
private static readonly DependencyProperty DummyTextProperty
29+
= DependencyProperty.RegisterAttached("DummyText",
30+
typeof(string),
31+
typeof(BindingHelper),
32+
new UIPropertyMetadata(null));
3333

3434
/// <summary>
3535
/// Evaluates a defined <see cref="Binding"/>-path on the given object
@@ -48,7 +48,7 @@ public static object Eval(object source, string expression)
4848
/// </summary>
4949
/// <param name="source">the object to evaluate</param>
5050
/// <param name="expression">the binding expression to evaluate</param>
51-
/// <param name="format">the stringformat to use</param>
51+
/// <param name="format">the string format to use</param>
5252
/// <returns>the result of the <see cref="Binding"/></returns>
5353
public static object Eval(object source, string expression, string format)
5454
{
@@ -70,29 +70,29 @@ public static object Eval(Binding binding, object source)
7070
}
7171

7272
Binding newBinding = new Binding
73-
{
74-
Source = source,
75-
AsyncState = binding.AsyncState,
76-
BindingGroupName = binding.BindingGroupName,
77-
BindsDirectlyToSource = binding.BindsDirectlyToSource,
78-
Path = binding.Path,
79-
Converter = binding.Converter,
80-
ConverterCulture = binding.ConverterCulture,
81-
ConverterParameter = binding.ConverterParameter,
82-
FallbackValue = binding.FallbackValue,
83-
IsAsync = binding.IsAsync,
84-
Mode = BindingMode.OneWay,
85-
StringFormat = binding.StringFormat,
86-
TargetNullValue = binding.TargetNullValue
87-
};
73+
{
74+
Source = source,
75+
AsyncState = binding.AsyncState,
76+
BindingGroupName = binding.BindingGroupName,
77+
BindsDirectlyToSource = binding.BindsDirectlyToSource,
78+
Path = binding.Path,
79+
Converter = binding.Converter,
80+
ConverterCulture = binding.ConverterCulture,
81+
ConverterParameter = binding.ConverterParameter,
82+
FallbackValue = binding.FallbackValue,
83+
IsAsync = binding.IsAsync,
84+
Mode = BindingMode.OneWay,
85+
StringFormat = binding.StringFormat,
86+
TargetNullValue = binding.TargetNullValue
87+
};
8888
return Eval(newBinding);
8989
}
9090

9191
/// <summary>
9292
/// Evaluates a defined <see cref="Binding"/> on the given <see cref="DependencyObject"/>
9393
/// </summary>
9494
/// <param name="binding">The <see cref="Binding"/> to evaluate</param>
95-
/// <param name="dependencyObject">optional: The <see cref="DependencyObject"/> to evalutate</param>
95+
/// <param name="dependencyObject">optional: The <see cref="DependencyObject"/> to evaluate</param>
9696
/// <returns>The resulting object</returns>
9797
public static object Eval(Binding binding, DependencyObject dependencyObject)
9898
{
@@ -120,4 +120,4 @@ public static object Eval(Binding binding)
120120
return Eval(binding, null);
121121
}
122122
}
123-
}
123+
}

src/MahApps.Metro/Controls/MultiSelectionComboBox/ICompareObjectToString.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,14 @@ public interface ICompareObjectToString
1919
/// <param name="input">The string to compare</param>
2020
/// <param name="objectToCompare">The object to compare</param>
2121
/// <param name="stringComparison">The <see cref="StringComparison"/> used to check if the string matches</param>
22-
/// <param name="stringFormat">The string format to applay</param>
23-
/// <returns>true if the string represents the object, otherwise fase.</returns>
22+
/// <param name="stringFormat">The string format to apply</param>
23+
/// <returns>true if the string represents the object, otherwise false.</returns>
2424
public bool CheckIfStringMatchesObject(string input, object objectToCompare, StringComparison stringComparison, string stringFormat);
2525
}
2626

27-
2827
[MarkupExtensionReturnType(typeof(DefaultObjectToStringComparer))]
2928
public class DefaultObjectToStringComparer : MarkupExtension, ICompareObjectToString
3029
{
31-
private static DefaultObjectToStringComparer _Instance;
32-
3330
/// <inheritdoc/>
3431
public bool CheckIfStringMatchesObject(string input, object objectToCompare, StringComparison stringComparison, string stringFormat)
3532
{
@@ -63,7 +60,7 @@ public bool CheckIfStringMatchesObject(string input, object objectToCompare, Str
6360
/// <inheritdoc/>
6461
public override object ProvideValue(IServiceProvider serviceProvider)
6562
{
66-
return _Instance ??= new DefaultObjectToStringComparer();
63+
return this;
6764
}
6865
}
69-
}
66+
}

src/MahApps.Metro/Controls/MultiSelectionComboBox/IParseStringToObject.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ public interface IParseStringToObject
1616
/// </summary>
1717
/// <param name="input">The input string to parse</param>
1818
/// <param name="culture">The culture which should be used to parse</param>
19-
/// <param name="stringFormat">The string format to applay</param>
19+
/// <param name="stringFormat">The string format to apply</param>
2020
/// <returns>The object if successful, otherwise null</returns>
2121
object CreateObjectFromString(string input, CultureInfo culture, string stringFormat);
2222
}
23-
}
23+
}

0 commit comments

Comments
 (0)