tags:

views:

367

answers:

1

I have a custom control which needs to configure a MultiBinding in code, which requires a IMultiValueConverter. Is it good practice to use FrameworkElement.FindResource and require the Converter be definied as a resource or should I instanciate the converter in code?

I could have this in the theme Resource such that it is always there, but this seems a bit prone to mistake.

A: 

I don't follow your question, but maybe I can help anyways.

It usually just boils down to whether the converter makes sense outside the scope of your control. If not, declare it in your control. If it does, why does it? Should you perhaps be exposing properties on your control rather than the converter itself?

As for how you create it, you might want to check out this post that helps to keep your XAML cleaner.

HTH, Kent

Kent Boogaart
Thanks - that does apply to my question. I was looking to find the best practice for Resources like a Converter versus TemplateParts. Thanks
Ryan Cromwell