Is there an easy way to transform or format a string as part of WPF data binding?
Suppose I want to create a WPF Hyperlink element based on a string tag.
<Hyperlink NavigateUri="{Binding Tag}">
<Run Text="{Binding Tag}" />
</Hyperlink>
But I need to transform the Tag first for the NavigateUri property to make it a true hyperlink or PackUri.
For instance, if my tag were "folksonomy" I'd want to create a string like: http://www.example.com/tags/tagview?tag=folksonomy
What's the best way to achieve this? Is there a string manipulation function in XAML? Do I have to write a converter? Do a have to build a whole separate ViewModel class just to do a little string formatting?
UPDATE: There appears to be something strange going on with the Hyperlink element. I can get the StringFormat syntax suggested in the answers to work for an ordinary TextBlock, but not for a Hyperlink. I've tried both the NavigateUri and ToolTip properties, and neither seems to respect the StringFormat settings.
So apparently a custom converter or ViewModel property will be required.