is it a bad idea to have static wpf value converters?
Instead of declaring the converter in the Resources, i can do something like
IsEnabled={Binding Path=SomeProp, Converter={x:Static namespace:Conve开发者_如何学JAVArter.Instance}}"
where Instance is instantiated only once (lazy sinlgeton)
But i'm worried about keeping references to static variables might get in the way of garbage collection when disposing the views (i'm using PRISM). What do you think?
Indeed the static instance of the converter won't be garbage collected, but it's just one instance, and typical converters have no (or few) data fields, so it's probably nothing to worry about...
The converter has no reference to the views, so it shouldn't be a problem for garbage collection of the views.
精彩评论