hello,
I'm buzzy to create a custom listview witch has custom defined views based on the data it gets. I like
views with links such described in the example below and for example with a textbox and a textblock,
but it doesn't matter how it goes about it's idea.
I have a enum like this to know witch datatemplate must be used:
<pre>
public enum tabType
{
tabbedTextBlock = 1,
tabbedLinkedBlock = 2
}
This class is a class to store data in
public class person
{
private string firstName;
private string lastName;
private int age;
private tabType type;
public person()
{
}
public person(string firstName, string lastName, int age, tabType type)
{
this.FirstName = firstName;
this.LastName = lastName;
this.Age = age;
this.tabType = type;
}
public string FirstName
{
get;
set;
}
public string LastName
{
get;
set;
}
public int Age
{
get;
set;
}
public tabType tabType
{
get;
set;
}
a list of objects too be bind to the list
public class sampledata : ObservableCollection<person>
{
public sampledata() :base()
{
Add(new person("foo", "fofoo", 23, tabType.tabbedLinkedBlock));
Add(new person("apple", "fruit", 21, tabType.tabbedTextBlock));
Add(new person("pineapple", "fruit", 17, tabType.tabbedLinkedBlock));
Add(new person("banan", "fruit", 47, tabType.tabbedLinkedBlock));
Add(new person("kiwi", "fruit", 34, tabType.tabbedTextBlock));
}
}
the tabtype is used to let the custom listview class know witch type of datatemplate most be used.
I have searched for a view day's but couldn't found a nice working solution, only an idea but
it's written in VB.net with windows forms. It can be found
here.
thx,
DJohn