ailon's DevBlog: Development related stuff in my life

Creating Gapped and Bulleted Shapes in WPF/Silverlight

5/26/2009 10:08:37 AM

I’ve released a small control for creating bulleted paths in WPF. You can get it in download section of this blog. The main trick used in this control is described in my article titled “Creating Gapped and Bulleted Shapes in WPF/Silverlight” and published by

Tags: ,

Name scopes within templates are not supported

5/8/2009 3:03:59 PM

I’ve got an issue reported on amCharts for WPF forum suggesting that it’s impossible to use the charts in DataTemplate. I’ve verified that it was true and exception message reads as follows:

"NameScopeProperty found within the content of a FrameworkTemplate, on a 'AmCharts.Windows.LineChart' object. Name scopes within templates are not supported."

The exception was caused by the call to SetNameSpace method in the constructor of the chart base class:

NameScope.SetNameScope(this, new NameScope());

I’ve re-read documentation on name scopes and made an assumption that I have to find a way to use template’s own name scope to register my names with it and…  spent almost a day trying to figure out how to do it universally.

Finally I gave up on that branch of thought and decided to try something else. To my surprise the problem was solved by simply moving the same call to SetNameScope() from constructor to a place right before it is needed. Namely where I make the first call to RegisterName() which happens after my controls have been loaded, templates applied, etc.

Now I’m not completely sure why this worked but my understanding is that if you do it in the constructor SetNameScope() get’s called in the context of the Template (producing an exception above) and when it is called later it’s already in context of the control to which the Template is applied. Please, correct me if I’m wrong.

kick it on Shout it

Tags: ,

4 Tips for WPF Control Developers

5/5/2009 9:52:22 AM has published my article titled 4 Great Tips for Custom WPF Controls Developers.

Bonus tip: there’s a 50% discount coupon for amCharts for WPF at the end of that article ;)

Tags: ,

Copyright © 2003 - 2018 Alan Mendelevich
Powered by BlogEngine.NET