HierarchicalDataTemplate and XmlDataProvider : XmlDataProvider « Windows Presentation Foundation « C# / CSharp Tutorial

Home
C# / CSharp Tutorial
1.Language Basics
2.Data Type
3.Operator
4.Statement
5.String
6.struct
7.Class
8.Operator Overload
9.delegate
10.Attribute
11.Data Structure
12.Assembly
13.Date Time
14.Development
15.File Directory Stream
16.Preprocessing Directives
17.Regular Expression
18.Generic
19.Reflection
20.Thread
21.I18N Internationalization
22.LINQ
23.GUI Windows Forms
24.Windows Presentation Foundation
25.Windows Communication Foundation
26.Workflow
27.2D
28.Design Patterns
29.Windows
30.XML
31.XML LINQ
32.ADO.Net
33.Network
34.Directory Services
35.Security
36.unsafe
C# / C Sharp
C# / C Sharp by API
C# / CSharp Open Source
C# / CSharp Tutorial » Windows Presentation Foundation » XmlDataProvider 
24.149.1.HierarchicalDataTemplate and XmlDataProvider
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="TreeViewSelectedValue">
  <FrameworkElement.Resources>
    <XmlDataProvider x:Key="myCourseData" XPath="/CourseData">
      <x:XData>
        <CourseData xmlns="">
          <CourseInfo>
            <CourseName>A</CourseName>
            <CourseWorkDay>Monday</CourseWorkDay>
            <CourseWorkDay>Tuesday</CourseWorkDay>
            <CourseWorkDay>Wednesday</CourseWorkDay>
            <CourseWorkDay>Thrusday</CourseWorkDay>
            <CourseWorkDay>Friday</CourseWorkDay>
            <CourseStartTime>8:00am</CourseStartTime>
            <CourseNumber>12345</CourseNumber>
          </CourseInfo>
          <CourseInfo>
            <CourseName>B</CourseName>
            <CourseWorkDay>Monday</CourseWorkDay>
            <CourseWorkDay>Tuesday</CourseWorkDay>
            <CourseStartTime>6:30am</CourseStartTime>
            <CourseNumber>98765</CourseNumber>
          </CourseInfo>
        </CourseData>
      </x:XData>
    </XmlDataProvider>
    <HierarchicalDataTemplate DataType="CourseInfo" ItemsSource ="{Binding XPath=CourseWorkDay}">
      <TextBlock Text="{Binding XPath=CourseName}" />
    </HierarchicalDataTemplate>
  </FrameworkElement.Resources>
  <StackPanel>
    <TreeView ItemsSource="{Binding Source={StaticResource myCourseData}, XPath=CourseInfo}" 
        Name="myTreeView" SelectedValuePath="CourseNumber"/>

    <TextBlock Margin="10">SelectedValuePath: </TextBlock>
    <TextBlock Margin="10" Text="{Binding ElementName=myTreeView, Path=SelectedValuePath}"/>
    <TextBlock Margin="10">SelectedValue: </TextBlock>
    <TextBlock Margin="10" Text="{Binding ElementName=myTreeView, Path=SelectedValue}"/>

  </StackPanel>     

</Page>
WPF Hierarchical Data Template And Xml Data Provider
24.149.XmlDataProvider
24.149.1.HierarchicalDataTemplate and XmlDataProviderHierarchicalDataTemplate and XmlDataProvider
24.149.2.Xmldata island.xamlXmldata island.xaml
24.149.3.Hierarchical Xml TemplatesHierarchical Xml Templates
24.149.4.Using XmlDataProviderUsing XmlDataProvider
24.149.5.XmlDataProvider and static Xml resourceXmlDataProvider and static Xml resource
24.149.6.Retrieve data from XmlDataProvider with XPathRetrieve data from XmlDataProvider with XPath
24.149.7.XmlDataProvider and XmlNamespaceMappingXmlDataProvider and XmlNamespaceMapping
24.149.8.XmlDataProvider and ItemsControlXmlDataProvider and ItemsControl
24.149.9.Hyperlink and xpath filter for XmlDataProviderHyperlink and xpath filter for XmlDataProvider
24.149.10.Load XmlDocument to XmlDataProviderLoad XmlDocument to XmlDataProvider
24.149.11.Get XmlElement from Bounded viewGet XmlElement from Bounded view
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.