public object Convert(object value, Type targetType, object parameter, string language)
{
if (value == null || !(value is bool))
return PortableVisibility.Collapsed;
var visible = (bool) value;
if (parameter != null && (bool) parameter)
{
visible = !(bool) value;
}
return visible ? PortableVisibility.Visible : PortableVisibility.Collapsed;
}