-
-
Notifications
You must be signed in to change notification settings - Fork 298
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
3 changed files
with
70 additions
and
4 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
src/Gemini/Framework/ShaderEffects/Converters/IsNullConverter.cs
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 System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows.Data; | ||
|
||
namespace Gemini.Framework.ShaderEffects.Converters | ||
{ | ||
// From https://github.com/MahApps/MahApps.Metro/blob/9c331aa20b2b3fd6a9426e0687cfc535511bf134/MahApps.Metro/Converters/IsNullConverter.cs | ||
|
||
/// <summary> | ||
/// Converts the value from true to false and false to true. | ||
/// </summary> | ||
public sealed class IsNullConverter : IValueConverter | ||
{ | ||
private static IsNullConverter _instance; | ||
|
||
// Explicit static constructor to tell C# compiler | ||
// not to mark type as beforefieldinit | ||
static IsNullConverter() | ||
{ | ||
} | ||
|
||
private IsNullConverter() | ||
{ | ||
} | ||
|
||
public static IsNullConverter Instance | ||
{ | ||
get { return _instance ?? (_instance = new IsNullConverter()); } | ||
} | ||
|
||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) | ||
{ | ||
return null == value; | ||
} | ||
|
||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) | ||
{ | ||
return Binding.DoNothing; | ||
} | ||
} | ||
} |
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