Facebook Twitter Gplus LinkedIn YouTube Google Maps RSS
Home Technical IValueConverter: Int to Bool Converter
formats

IValueConverter: Int to Bool Converter

Published on June 30, 2010 by in Technical

using System;
using System.Windows;
using System.Windows.Data;

namespace Ravi.Infrastructure.Converters
{
public class CopnvertIntToBool : IValueConverter
{
#region Methods
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if(value == null || parameter == null)
return false;

return System.Convert.ToInt32(value) == System.Convert.ToInt32(parameter);
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if(System.Convert.ToBoolean(value))
return System.Convert.ToInt32(parameter);
else
{
return DependencyProperty.UnsetValue;
}
}
#endregion Methods
}

}

 
 Share on Facebook Share on Twitter Share on Reddit Share on LinkedIn
No Comments  comments 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

* Copy this password:

* Type or paste password here:

12,871 Spam Comments Blocked so far by Spam Free Wordpress

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© All rights reserved to Cyberbrutus. 2012
credit

Switch to our mobile site