WPF Tip: Names can't have ":" in them...
If you are doing storyboard-based animation, the animation is hooked up to a specific element through a unique id. You write code something like this:
element.Name = "Fred";
window.RegisterName(element.Name, element);
The second call establishes the relationship between the name and the object.
If you're writing cod where there are multiple elements, you need to create unique names. So, something like:
element.Name = "Fred_" + m_id.ToString();
m_id++;
works great. However, if you use:
element.Name = "Fred:" + m_id.ToString();
m_id++;
You'll get a not-very-helpful exception...
Comments
Anonymous
March 20, 2007
PingBack from http://liangwu.wordpress.com/2007/03/20/interesting-finding-03202007/Anonymous
March 21, 2007
Actually the naming convention for the Name attribute is coherent with the C#'s naming convention for variables. Sheva