WPF Data Binding - Displaying the list of system fonts -


Using XAML, I am trying to get a list box to display the list of system fonts.

I'm not sure whether to type in binding string.

Here's my attempt:

  & lt; Window x: class = "ListDataBinding.Window1" xmlns = "http: //schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns: x = "http://schemas.microsoft.com/winfx/2006/ Xaml "xmlns: m =" clr- namespace: system. Windows. Media; assembly = presenter "title =" window 1 "height =" 300 "width =" 300 "& gt; & Lt; Grid & gt; & Lt; List box itemsource = "{binding source = {static resource M: fonts.SystemFontFilees}}" & gt; & Lt; / ListBox & gt; & Lt; / Grid & gt; & Lt; / Window & gt;  

I get an error: A resource named '{m: Fonts.SystemFontFamilies}' can not be found.

I wonder what I should type. I have not succeeded in finding an assistant MSDN page - I would be grateful if someone could point me at a link.

  & lt; Window x: class = "list data bindings. Window 1" xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns: x = "http: //schemas.microsoft.com/winfx/ 2006 / xaml "xmlns: m =" clr-namespace: System.Windows.Media; assembly = presenter "title =" window 1 "height =" 300 "width =" 300 "& gt; & Lt; Window.Resources & gt; & Lt; ObjectDataProvider x: Key = "fontFamiliesKey" object type = "{x: type m: font}" MethodName = "get_SystemFontFamilies" /> & Lt; /Window.Resources> & Lt; Grid & gt; & Lt; List box itemsource = "{binding source = {static resource fontfile}}" & gt; & Lt; / ListBox & gt; & Lt; / Grid & gt; & Lt; / Window & gt;  

Try it


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -