|
// -- FILE ------------------------------------------------------------------
// name : CustomerStateGridViewColumn.cs
// created : Jani Giannoudis - 2008.03.27
// language : c#
// environment: .NET 3.0
// --------------------------------------------------------------------------
using System;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using Itenso.Windows.Controls.ListViewLayout;
namespace Itenso.Windows.Controls.ListViewLayoutDemo
{
// ------------------------------------------------------------------------
public class CustomerStateGridViewColumn : ImageGridViewColumn
{
// ----------------------------------------------------------------------
public CustomerStateGridViewColumn( string header )
{
Header = header;
} // CustomerStateGridViewColumn
// ----------------------------------------------------------------------
protected override ImageSource GetImageSource( object value )
{
Customer customer = value as Customer;
if ( customer != null )
{
string imageUri = string.Concat(
packName,
GetType().Namespace,
resourcePath,
"CustomerState",
Enum.GetName( typeof( CustomerState ), customer.State ),
resourceImageExtension );
return new BitmapImage( new Uri( imageUri ) );
}
return null;
} // GetImageSource
// ----------------------------------------------------------------------
// members
private const string packName = "pack://application:,,,/";
private const string resourcePath = ";Component/Resources/";
private const string resourceImageExtension = ".png";
} // class CustomerStateGridViewColumn
} // namespace Itenso.Windows.Controls.ListViewLayoutDemo
// -- EOF -------------------------------------------------------------------
|
By viewing downloads associated with this article you agree to the Terms of Service 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.
👨 Senior .NET Software Engineer
🚀 My Open Source Projects
-
Time Period Library 👉
GitHub
-
Payroll Engine 👉
GitHub
Feedback and contributions are welcome.