-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUIConvert.cs
34 lines (33 loc) · 1.23 KB
/
UIConvert.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml;
namespace UniversalPlatformTools
{
/// <summary>
/// Convert from base data types to UI data types and vice versa
/// </summary>
public static class UIConvert
{
/// <summary>
/// Converts the specified boolean value to a <see cref="Visibility"/> value.
/// </summary>
/// <param name="value">The valuue to convert from</param>
/// <returns><see cref="Visibility.Visible"/> if parameter is True, otherwise returns <see cref="Visibility.Collapsed"/></returns>
public static Visibility ToVisibility(bool value)
{
return (value) ? Visibility.Visible : Visibility.Collapsed;
}
/// <summary>
/// Converts the specified <see cref="Visibility"/> value to a boolean value.
/// </summary>
/// <param name="visibility">Tge value to convert from</param>
/// <returns>True if parameter is <see cref="Visibility.Visible"/> otherwise, False.</returns>
public static bool ToBoolean(Visibility visibility)
{
return (visibility == Visibility.Visible);
}
}
}