|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
namespace BindableConverterParameter
{
public class MyModelView : DependencyObject
{
public MyModelView()
{
FirstName = "John";
ConcatSign = "-";
}
public String FirstName
{
get { return (String)GetValue(FirstNameProperty); }
set { SetValue(FirstNameProperty, value); }
}
// Using a DependencyProperty as the backing store for FirstName. This enables animation, styling, binding, etc...
public static readonly DependencyProperty FirstNameProperty =
DependencyProperty.Register("FirstName", typeof(String), typeof(MyModelView), new UIPropertyMetadata("John"));
public String ConcatSign
{
get { return (String)GetValue(ConcatSignProperty); }
set { SetValue(ConcatSignProperty, value); }
}
// Using a DependencyProperty as the backing store for ConcatSign. This enables animation, styling, binding, etc...
public static readonly DependencyProperty ConcatSignProperty =
DependencyProperty.Register("ConcatSign", typeof(String), typeof(MyModelView), new UIPropertyMetadata("-"));
}
}
|
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.
Henrik Jonsson is a Microsoft Professional Certified Windows Developer (MCPD) that currently works as an IT consultant in Västerås, Sweden.
Henrik has worked in several small and large software development projects in various roles such as architect, developer, CM and tester.
He regularly reads The Code Project articles to keep updated about .NET development and get new ideas. He has contributed with articles presenting some useful libraries for
Undo/Redo,
Dynamic Linq Sorting and a
Silverlight 5 MultiBinding solution.