I just saw a strange behavior that looks like a bug. Consider the following XAML:
& lt; 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 = MScorib "& gt; & Lt; Page.Resources & gt; & Lt; X: array x: key = "data" type = "{x :: type :: string}" & gt; & Lt; Sys: string & gt; Foo & lt; / Sys: string & gt; & Lt; Sys: string & gt; Bar & lt; / Sys: string & gt; & Lt; Sys: string & gt; Hail & lt; / Sys: string & gt; & Lt; / X: array & gt; & Lt; /Page.Resources> & Lt; StackPanel Orientation = "Vertical" & gt; & Lt; Button & gt; Bu & lt; / Button & gt; & Lt; Combo box name = "combo" items source = "{binding source = {static processing data}}" item stingformat = "## {0} ##" /> & Lt; TextBlock Text = "{binding text, elementname = combo}" /> & Lt; / StackPanel & gt; & Lt; / Page & gt; Displays the value as combo box
"## Foo ##", "## Bar ##" and "## Badge ##". But TextBlock
displays the selected values as "Foo", "Bar" and "False". So the ItemStringFormat
has apparently been ignored for text
property ...
is this a bug? If so, then what is the solution?
Am I doing something wrong?
Not a bug: ItemStringFormat
"Only a shortcut for the data template There is a text block bound to value with specified string format specified in the binding ". text
but generally when isEditable
is true and represents user-input, it is used when you have nothing except strings in your list, Then it is better to use SelectedItem
with Text
. In either case, the following code will re-apply the format of the text:
& lt; TextBlock Text = "{binding element name = combo, path = text, string format = '## {0} # #'}" />
Comments
Post a Comment