|
using System.Windows;
using System.Windows.Controls;
namespace DataContextOfHiddenTabs
{
/// <summary>
/// Interaction logic for PlanetControl.xaml
/// </summary>
public partial class PlanetControl : UserControl
{
int _id;
static int _count;
public PlanetControl()
{
_id = ++_count;
InitializeComponent();
}
public string PlanetName
{
get { return (string)GetValue(PlanetNameProperty); }
set { SetValue(PlanetNameProperty, value); }
}
// Using a DependencyProperty as the backing store for PlanetName. This enables animation, styling, binding, etc...
public static readonly DependencyProperty PlanetNameProperty =
DependencyProperty.Register("PlanetName", typeof(string), typeof(PlanetControl), new UIPropertyMetadata(null, OnPlanetNameChanged));
private static void OnPlanetNameChanged(object sender, DependencyPropertyChangedEventArgs args)
{
var planetControl = sender as PlanetControl;
if (planetControl == null) return;
var str = "(null)";
if (args.NewValue != null)
{
str = args.NewValue.ToString();
}
PlanetControlSpy.Instance.RegisterControl(planetControl._id, str);
}
}
}
|
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.
Ivan is a hands-on software architect/technical lead working for Thomson Reuters in the New York City area. At present I am mostly building complex multi-threaded WPF application for the financial sector, but I am also interested in cloud computing, web development, mobile development, etc.
Please visit my web site:
www.ikriv.com.