I am trying to bind data from text files (and the names of those files) to a ListBox in a C# Metro style app.
I’ve checked out the Metro Samples – I haven’t been able to make too much sense out of them though. I’m relatively new to XAML to begin with, and throwing that ontop of Metro-style apps just adds to the confusion.
For something that is such a trivial task in WinForms, it feels like I’m trying to write my own OS!
Can someone please help me out a little? I’ve searched and searched but I just end up finding the same old tutorials/documentation; and maybe it’s just me, but I feel that the documentation is lacking in this area. Maybe it’s just not complete yet?
Any help at all will be much appreciated 🙂
V declare a dictionary and loop through all your files adding the name as a key and the contents of the file as the value.
In XAML then bind the listbox to the items in the dictionary and set the displaymemberpath to the key of the KeyValuePair.
When selecting update the other control that will show your contents.
I’ll look if i can make a example for you in code.
Here the Example please do not look at the styling 🙂 Used MVVM for this
My ViewModel
}
the xaml
And in the codebehind of the xaml say