- Source_Code.zip
- Source Code
- Apex
- Apex.sln
- Silverlight
- Apex.Silverlight
- Adorners
- Apex.Silverlight.csproj
- Apex.Silverlight.csproj.user
- Commands
- Consistency
- Controls
- Converters
- Design
- DragAndDrop
- Extensions
- MVVM
- Properties
- Themes
- Samples
- CommandingSample
- ControlsSample
- DragAndDropSample
- MVVMSample
- WP7
- Apex.WP7
- Apex.WP7.csproj
- Commands
- Consistency
- Controls
- Converters
- Extensions
- MVVM
- Properties
- Samples
- CommandingSample
- ControlsSample
- MVVMSample
- WPF
- Apex
- Adorners
- Apex.csproj
- Commands
- Consistency
- Controls
- Converters
- Design
- DragAndDrop
- Extensions
- MVVM
- Properties
- Snippets
- .vscontent
- InsertAttachedProperty.snippet
- InsertDependencyProperty.snippet
- InsertNotifyingProperty.snippet
- InsertViewModelCommand.snippet
- Themes
- Samples
- CommandingExample
- ControlsSample
- DragAndDropSample
- MVVMSample
- Apex_Binaries.zip
- Apex Binaries
- Apex.dll
- Apex.Silverlight.dll
- Apex.WP7.dll
- Example_Applications.zip
- Example Applications
- Silverlight
- WP7
- WPF
- Apex.dll
- CommandingSample.exe
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Windows;
namespace Apex.Converters
{
public class BooleanToVisibilityConverter : IValueConverter
{
#region IValueConverter Members
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
// If the data isn't a bool, bail.
if (value is bool == false)
return null;
// Cast the data.
bool boolean = (bool)value;
// If we have the invert string, return the inverted value.
if (parameter != null && parameter.ToString() == "Invert")
{
return boolean ? Visibility.Collapsed : Visibility.Visible;
}
else
{
return boolean ? Visibility.Visible : Visibility.Collapsed;
}
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
#endregion
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.