CSLA.NET 5.4.2
CSLA .NET is a software development framework that helps you build a reusable, maintainable object-oriented business layer for your app.
BrokenRulesSeverityConverter.cs
Go to the documentation of this file.
1#if !XAMARIN && !WINDOWS_UWP
2//-----------------------------------------------------------------------
3// <copyright file="BrokenRulesSeverityConverter.cs" company="Marimer LLC">
4// Copyright (c) Marimer LLC. All rights reserved.
5// Website: https://cslanet.com
6// </copyright>
7// <summary>Converts validation severity values into corresponding</summary>
8//-----------------------------------------------------------------------
9using System;
10using Csla.Rules;
11using System.Windows.Resources;
12using System.Windows.Media.Imaging;
13using System.Windows;
14using System.Windows.Data;
15
16namespace Csla.Xaml
17{
22 public class BrokenRuleSeverityConverter : IValueConverter
23 {
33 public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
34 {
35 RuleSeverity severity = (RuleSeverity)value;
36 string uri = string.Format("/Csla.Xaml;component/Resources/{0}.png", severity);
37 StreamResourceInfo sr = Application.GetResourceStream(new Uri(uri, UriKind.Relative));
38 BitmapImage bmp = new BitmapImage();
39 bmp.BeginInit();
40 bmp.StreamSource = sr.Stream;
41 bmp.EndInit();
42
43 return bmp;
44 }
45
53 public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
54 {
55 return RuleSeverity.Error;
56 }
57 }
58}
59#endif
Converts validation severity values into corresponding images.
object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
Converts validation severity values into corresponding images.
object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
Returns the original value.
RuleSeverity
Values for validation rule severities.
Definition: RuleSeverity.cs:16