-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added multiple background modes for UI-Editor
- Loading branch information
Showing
9 changed files
with
141 additions
and
12 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,56 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Globalization; | ||
using System.Linq; | ||
using System.Reflection; | ||
using System.Resources; | ||
using System.Windows; | ||
using System.Windows.Data; | ||
|
||
namespace Arma.Studio.Data.UI.Converters | ||
{ | ||
/// <summary> | ||
/// Converts the passed <see cref="Enum"/> value to the corresponding <see cref="String"/> representing its name. | ||
/// Requires the parameter to be the <see cref="Type"/> of the enum to convert. | ||
/// Can convert backwards. | ||
/// </summary> | ||
public class EnumSourceConverter : IValueConverter | ||
{ | ||
public static EnumSourceConverter Instance { get => _Instance; set => _Instance = value; } | ||
private static EnumSourceConverter _Instance; | ||
|
||
static EnumSourceConverter() | ||
{ | ||
_Instance = new EnumSourceConverter(); | ||
} | ||
/// <summary> | ||
/// Converts a value | ||
/// </summary> | ||
/// <param name="value">The value produced by the binding source.</param> | ||
/// <param name="targetType">The type of the binding target property.</param> | ||
/// <param name="parameter">The converter parameter to use.</param> | ||
/// <param name="culture">The culture to use in the converter.</param> | ||
/// <returns>A converted value. If the method returns null, the valid null value is used.</returns> | ||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
if (value is Type t && t.IsEnum) | ||
{ | ||
return Enum.GetValues(t); | ||
} | ||
return null; | ||
} | ||
|
||
/// <summary> | ||
/// Converts a value. | ||
/// </summary> | ||
/// <param name="value">The value that is produced by the binding target.</param> | ||
/// <param name="targetType">The type to convert to.</param> | ||
/// <param name="parameter">The converter parameter to use.</param> | ||
/// <param name="culture">The culture to use in the converter.</param> | ||
/// <returns>A converted value. If the method returns null, the valid null value is used.</returns> | ||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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