I just noticed a strange behavior which looks like a bug. Consider the following XAML :
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib">
<Page.Resources>
<x:Array x:Key="data" Type="{x:Type sys:String}">
<sys:String>Foo</sys:String>
<sys:String>Bar</sys:String>
<sys:String>Baz</sys:String>
</x:Array>
</Page.Resources>
<StackPanel Orientation="Vertical">
<Button>Boo</Button>
<ComboBox Name="combo" ItemsSource="{Binding Source={StaticResource data}}" ItemStringFormat="##{0}##" />
<TextBlock Text="{Binding Text, ElementName=combo}"/>
</StackPanel>
</Page>
The ComboBox
displays the values as "##Foo##", "##Bar##" and "##Baz##". But the TextBlock
displays the selected values as "Foo", "Bar" and "Baz". So the ItemStringFormat
is apparently ignored for the Text
property...
Is that a bug ? If it is, is there a workaround ?
Or am I just doing something wrong ?