Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top