Last active
August 29, 2015 14:15
-
-
Save BrianJVarley/bf3b3edb83d251419435 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
using System; | |
using System.Collections.Generic; | |
using System.Globalization; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Windows; | |
using System.Windows.Data; | |
namespace MyoTestv4.Home | |
{ | |
public class BoolToVisibilityConverter : IValueConverter | |
{ | |
public object Convert(object value, Type targetType, | |
object parameter, CultureInfo culture) | |
{ | |
// Do the conversion from bool to visibility | |
bool bValue = (bool)value; | |
if (bValue) | |
return Visibility.Visible; | |
else | |
return Visibility.Hidden; | |
} | |
public object ConvertBack(object value, Type targetType, | |
object parameter, CultureInfo culture) | |
{ | |
// Do the conversion from visibility to bool | |
Visibility visibility = (Visibility)value; | |
if (visibility == Visibility.Hidden) | |
return true; | |
else | |
return false; | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment