converters

Currency formatting on ComboBox items

I have a ComboBox bound to an ObservableCollection of decimals. What is the correct way to apply our currency converter to the items? Edit: a) I have an existing currency converter that I must use b) .NET 3.0 Do I need to template the items? ...

How to return specific date format as JSON in Grails?

In Grails, you can use the JSON converters to do this in the controller: render Book.list() as JSON The render result is [ {"id":1, "class":"Book", "author":"Stephen King", "releaseDate":'2007-04-06T00:00:00', "title":"The Shining"} ] You can control the output date by make a setting in Config.groovy grails.converters.json.dat...

Why does my converter giving an invalid cast error?

I created a Converter to convert from double to integer. But the line "return (int)value;" always gets a "specified cast is not valid." What do I have to do so that my Converter successfully converts a double and sends back an integer? Converter: namespace TestChangeAngle { [ValueConversion(typeof(double), typeof(int))] class...

How can I easily add a WPF Converter item template to Visual Studio?

I find myself creating Converters often and would like to be able to: right-click on my Converters folder Add New Item... choose Converter Item Template I found these instructions but I can imagine that there are templates for standard files like WPF Converters already available somewhere, does anyone know of any? The following file...

Bind Image.Source according to Boolean without a converter?

Hi I want to have an image bound to a boolean and have the source of the image to depend on the boolean value i.e. true source="image1" false source="image2" I was wondering if there is a way to do it inline without need for a converter. ...

WPF Binding & Converters

I've been recently playing with WPF and I've come across a number of problems that I can't solve. I have the following code in my generic.xaml: <Style TargetType="{x:Type local:ClearButton}"> <Style.Resources> <con:ValueConverter x:Key="converter" /> </Style.Resources> <Setter Property="Width" Value="20" /> ...

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:Converter.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 dispo...

When will the ValueConverter's Convert method be called in wpf

I have an ObservableCollection bound to a list box and a boolean property bound to a button. I then defined two converters, one that operates on the collection and the other operates on the boolean property. Whenever I modify the boolean property, the converter's Convert method is called, where as the same is not called if I modify the o...

Experiences with "language converters"?

I have read a few articles mentioning converters from one language to another. I'm a bit more than skeptical about the use of such kind of tools. Does anyone know or have experiences let's say about Visual Basic to Java or vs converters? Just one example to pick http://www.tvobjects.com/products/products.html, claims to be the "world...