I'm new to WPF and trying to mash together some concepts I'm reading about.
What I'm trying to do is a build a localizable UI. For simplicity, let's say I am building a UI with string: "The file takes up 2 GB in disk space."
The "2 GB" portion is dynamic. The value could change depending upon the file the user selects. Secondly, a conversion should take from ulong (file size bytes) to string (friendly size, using appropriate units e.g. KB, MB, GB, TB, etc.).
I was thinking an IValueConverter
would be most appropriate for the byte count to friendly-file-size conversion. I was also thinking that I'd store "The file takes up {0} in disk space." as a string resource.
I'm not sure the IValueConverter
will be of use here. Can it be used with String.Format()
? I don't see how it could be used in a binding directly, because we're inserting the conversion result into the localizable text template.
Is there a better way to approach this?