c# - Image.Source not showing image when using a string formatted binding -


I am currently using the following code: combo box to flag images and the Canadian province Name to control with Although images are not visible in control I have tested the binding and have generated this place properly, but the image is not just under control.

Changed value "=" province code "item source =" {binding provinces, relative Soros = {relative serge ancestor type = {name} = "Cb_Provinces" text = "province" selection = changed "combo box selection" X: type user control}}} & gt; combobox.itemTemplate & gt; & gt; DataTemplate & gt; & lt; stackPanel & gt; & lt; stackPanel x: name = "stk_ComboTemplate" orientation = "horizontal "Horizontal Alignment =" Left "& gt; Image Width =" 25 "Margin =" 10 "Source =" {Binding Province Code, Stringf Ormet = / Canada Trysvisiintrfes; Component / resource / img / flag / \ {0 \}. GIF} "/> TextBlock FontSize =" 10 "Foreground =" Gray "Text =" {Binding Province code, string format = / canvas TSV Interface; Component / resource / img / flag / \ {0 \}. Gif} "/>

Output Result:

Enter image details here

string format only works when the target type is string because image from source type URI string will never be used in binding

The best option is IValueCo To format the nverter to string and Image source property.

Example:

Usage: < / P> & lt; window; Resources & gt; & lt; local: provinceNameToImageSourceConverter x: key = "ImageConverter" /> & lt; /Window.Resources> ....... ........... & lt; image source = "{binding province code, converter = {static resource image converters}}" /> < / Html>

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -