MVVMSharp_Code.zip
CustomerMaintenance
Controllers
Base Classes
bin
Release
Controllers.csproj.vs10x
Properties
CustomerMaintenance
bin
Debug
CustomerMaintenance.vshost.exe
CustomerMaintenance.vshost.exe.manifest
Release
CustomerMaintenance.csproj.user
CustomerMaintenance.csproj.vs10x
Properties
Settings.settings
Messengers
bin
Release
Messengers.csproj.vs10x
Properties
Model
bin
Debug
Release
Models.csproj.vs10x
Properties
Service
bin
Release
Properties
Services.csproj.vs10x
ViewModel
BaseClasses
bin
Release
Properties
ViewData
ViewModels.csproj.vs10x
Views
Base Classes
bin
Release
Converters
DesignTimeData
Properties
Settings.settings
Views.csproj.vs10x
|
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace Views
{
/*
* This source file contains all the converters used.
*/
/// <summary>
/// Returns false if the object is null, true otherwise.
/// handy for using when something needs to be enabled or disabled depending on
/// whether a value has been selected from a list.
/// </summary>
[ValueConversion(typeof(object), typeof(bool))]
public class NullToFalseBooleanConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return (value != null);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return null;
}
}
/// <summary>
/// Returns false if the object is null, true otherwise.
/// handy for using when something needs to be enabled or disabled depending on
/// whether a value has been selected from a list.
/// </summary>
[ValueConversion(typeof(object), typeof(Visibility))]
public class NullToHiddenVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null)
{
return Visibility.Hidden;
}
else
{
return Visibility.Visible;
}
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return null;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of use 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.
_Maxxx_
Software Developer (Senior)
Australia
Software developer par excellence,sometime artist, teacher, musician, husband, father and half-life 2 player (in no particular order either of preference or ability)