Click here to Skip to main content
15,867,453 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: Multiple calls to same wcf service method from Silverlight application Pin
Abhinav S4-Jul-11 3:22
Abhinav S4-Jul-11 3:22 
AnswerRe: Multiple calls to same wcf service method from Silverlight application Pin
Mark Salsbery4-Jul-11 8:54
Mark Salsbery4-Jul-11 8:54 
AnswerRe: Multiple calls to same wcf service method from Silverlight application Pin
BobJanova5-Jul-11 0:59
BobJanova5-Jul-11 0:59 
QuestionProblem with DataGrid Rows in WPF Pin
Member 29729921-Jul-11 3:24
Member 29729921-Jul-11 3:24 
AnswerRe: Problem with DataGrid Rows in WPF Pin
Mycroft Holmes2-Jul-11 12:40
professionalMycroft Holmes2-Jul-11 12:40 
QuestionQ1: Populate TreeView from source (C#) Pin
Mc_Topaz30-Jun-11 23:34
Mc_Topaz30-Jun-11 23:34 
AnswerRe: Q1: Populate TreeView from source (C#) Pin
Pete O'Hanlon1-Jul-11 0:05
subeditorPete O'Hanlon1-Jul-11 0:05 
QuestionQ2: Implement TreeView with multi level of data Pin
Mc_Topaz1-Jul-11 1:19
Mc_Topaz1-Jul-11 1:19 
I know what the TreeView can do in WPF, I just don't know how to do it. So I start very simple and continue on that.
Thanks by the way for the code, it did the trick when I found out how to make a XAML-namespace reference Smile | :)
xmlns:local="clr-namespace:TreeView"

Notice I have change my namespace from WpfApplication1 to TreeView


Now I want to implement the TreeView to add sub TreeViewItems for some of the already existing TreeViewItems. I have changed my C# to:
namespace TreeView
{
    public partial class MainWindow : Window
    {
        List<Person> persons;

        public MainWindow()
        {
            InitializeComponent();

            persons = new List<Person>();

            Person p1 = new Person("Person1");
            p1.Children.Add(new Person("Children1"));
            p1.Children.Add(new Person("Children2"));
            persons.Add(p1);

            persons.Add(new Person("Person2"));

            Person p3 = new Person("Person3");
            p3.Children.Add(new Person("Children1"));
            persons.Add(p3);

            persons.Add(new Person("Person4"));
            persons.Add(new Person("Person5"));

            tvTree.ItemsSource = persons;
        }
    }

    public class Person
    {
        List<Person> children = new List<Person>();
        string name;

        public Person(string name)
        {
            this.name = name;
        }

        public string Name
        {
            get { return name; }
        }

        public List<Person> Children
        {
            get { return children; }
            set { children = value; }
        }
    }
}


As expected no XAML code is written to handle the Children list so no sub TreeItemView is visible. How shall I implement that in my XAML code?
AnswerRe: Q2: Implement TreeView with multi level of data Pin
Pete O'Hanlon1-Jul-11 1:30
subeditorPete O'Hanlon1-Jul-11 1:30 
GeneralRe: Q2: Implement TreeView with multi level of data Pin
Mc_Topaz1-Jul-11 2:14
Mc_Topaz1-Jul-11 2:14 
GeneralRe: Q2: Implement TreeView with multi level of data Pin
Pete O'Hanlon1-Jul-11 2:22
subeditorPete O'Hanlon1-Jul-11 2:22 
QuestionQ3: Implement TreeView with two data source classes [modified] Pin
Mc_Topaz3-Jul-11 23:45
Mc_Topaz3-Jul-11 23:45 
QuestionSync call to WCF Methods Pin
NTheOne30-Jun-11 19:03
NTheOne30-Jun-11 19:03 
AnswerRe: Sync call to WCF Methods Pin
Pete O'Hanlon30-Jun-11 21:41
subeditorPete O'Hanlon30-Jun-11 21:41 
QuestionCreate event in UserControl Pin
jadughar30-Jun-11 10:55
jadughar30-Jun-11 10:55 
AnswerRe: Create event in UserControl Pin
Mark Salsbery30-Jun-11 13:43
Mark Salsbery30-Jun-11 13:43 
GeneralRe: Create event in UserControl Pin
jadughar30-Jun-11 21:12
jadughar30-Jun-11 21:12 
GeneralRe: Create event in UserControl Pin
Mark Salsbery1-Jul-11 6:26
Mark Salsbery1-Jul-11 6:26 
GeneralRe: Create event in UserControl Pin
jadughar1-Jul-11 7:59
jadughar1-Jul-11 7:59 
GeneralRe: Create event in UserControl Pin
Mark Salsbery1-Jul-11 8:09
Mark Salsbery1-Jul-11 8:09 
GeneralRe: Create event in UserControl Pin
jadughar1-Jul-11 10:45
jadughar1-Jul-11 10:45 
GeneralRe: Create event in UserControl Pin
Mark Salsbery1-Jul-11 12:04
Mark Salsbery1-Jul-11 12:04 
GeneralRe: Create event in UserControl Pin
jadughar2-Jul-11 0:11
jadughar2-Jul-11 0:11 
GeneralRe: Create event in UserControl Pin
Mark Salsbery2-Jul-11 6:19
Mark Salsbery2-Jul-11 6:19 
GeneralRe: Create event in UserControl Pin
jadughar3-Jul-11 22:15
jadughar3-Jul-11 22:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.