-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
apps: Added BoolToImageSourceConverter to WinUI sample app.
Showing
4 changed files
with
49 additions
and
7 deletions.
There are no files selected for viewing
Binary file not shown.
22 changes: 22 additions & 0 deletions
22
src/apps/H.NotifyIcon.Apps.WinUI/Converters/BoolToImageSourceConverter.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,22 @@ | ||
namespace H.NotifyIcon.Apps.Converters; | ||
|
||
public class BoolToImageSourceConverter : IValueConverter | ||
{ | ||
public ImageSource? TrueImage { get; set; } | ||
public ImageSource? FalseImage { get; set; } | ||
|
||
public object? Convert(object? value, Type targetType, object? parameter, string language) | ||
{ | ||
if (value is true) | ||
{ | ||
return TrueImage; | ||
} | ||
|
||
return FalseImage; | ||
} | ||
|
||
public object ConvertBack(object value, Type targetType, object parameter, string language) | ||
{ | ||
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
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