Click here to Skip to main content
15,911,485 members
Home / Discussions / WPF
   

WPF

 
QuestionTreeview - XML - HierarchicalDataTemplate Pin
RugbyLeague5-Nov-10 6:20
RugbyLeague5-Nov-10 6:20 
I am sure this something really simple and I have been looking at it for too long but why doesn't this show anything?

   public partial class Window1 : Window
    {
        public XmlDataProvider Provider { get; set; }

        public Window1()
        {
            InitializeComponent();

            Provider = new XmlDataProvider();
            Provider.Document = new XmlDocument();
            Provider.Document.LoadXml(TestXml.Test.Test());
            Provider.XPath = "Halloumi";
        }
    }


<Window x:Class="HalloumiDesigner.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300"
    DataContext="{Binding RelativeSource={RelativeSource Self}}">
    
    <Window.Resources>
        
        <HierarchicalDataTemplate DataType="Database" ItemsSource="{Binding XPath=Databases/Database}">
            <Border BorderBrush="SteelBlue"
                    BorderThickness="2"
                    Background="AliceBlue">
                <TextBlock Text="{Binding XPath=@Name}" />
            </Border>
        </HierarchicalDataTemplate>

    </Window.Resources>
    
    <Grid>
        <TreeView Name="TreeView" ItemsSource="{Binding Provider}" Margin="10" />
    </Grid>
</Window>


XML is:

<Halloumi>
                   <Databases>
                       <Database Name="A"/>
                       <Database Name="B"/>
                   </Databases>
               </Halloumi>

AnswerRe: Treeview - XML - HierarchicalDataTemplate Pin
RugbyLeague7-Nov-10 22:13
RugbyLeague7-Nov-10 22:13 
GeneralRe: Treeview - XML - HierarchicalDataTemplate Pin
Kevin Marois11-Nov-10 5:38
professionalKevin Marois11-Nov-10 5:38 
GeneralRe: Treeview - XML - HierarchicalDataTemplate Pin
RugbyLeague11-Nov-10 5:39
RugbyLeague11-Nov-10 5:39 
QuestionEye that follow cursor of the mouse Pin
VisualLive4-Nov-10 23:59
VisualLive4-Nov-10 23:59 
Question2 web sites 1 source of uploads Pin
Mycroft Holmes4-Nov-10 17:50
professionalMycroft Holmes4-Nov-10 17:50 
AnswerRe: 2 web sites 1 source of uploads Pin
AspDotNetDev4-Nov-10 18:05
protectorAspDotNetDev4-Nov-10 18:05 
GeneralRe: 2 web sites 1 source of uploads Pin
Mycroft Holmes4-Nov-10 20:38
professionalMycroft Holmes4-Nov-10 20:38 
GeneralRe: 2 web sites 1 source of uploads Pin
AspDotNetDev5-Nov-10 16:52
protectorAspDotNetDev5-Nov-10 16:52 
GeneralRe: 2 web sites 1 source of uploads Pin
Mycroft Holmes5-Nov-10 18:52
professionalMycroft Holmes5-Nov-10 18:52 
GeneralRe: 2 web sites 1 source of uploads Pin
AspDotNetDev5-Nov-10 19:05
protectorAspDotNetDev5-Nov-10 19:05 
AnswerRe: 2 web sites 1 source of uploads Pin
#realJSOP5-Nov-10 2:51
professional#realJSOP5-Nov-10 2:51 
GeneralRe: 2 web sites 1 source of uploads Pin
Mycroft Holmes5-Nov-10 3:22
professionalMycroft Holmes5-Nov-10 3:22 
QuestionValidation Pin
eddieangel3-Nov-10 12:13
eddieangel3-Nov-10 12:13 
Questiondefault button height? Pin
SledgeHammer013-Nov-10 10:02
SledgeHammer013-Nov-10 10:02 
AnswerRe: default button height? Pin
Nish Nishant3-Nov-10 11:30
sitebuilderNish Nishant3-Nov-10 11:30 
QuestionNeed information about GetStylesWithTargetType Pin
mtproc3-Nov-10 9:16
mtproc3-Nov-10 9:16 
AnswerRe: Need information about GetStylesWithTargetType Pin
mtproc4-Nov-10 5:50
mtproc4-Nov-10 5:50 
QuestionListView Inside TreeListView Pin
krishnan.s3-Nov-10 5:57
krishnan.s3-Nov-10 5:57 
AnswerRe: ListView Inside TreeListView Pin
Kevin Marois11-Nov-10 5:39
professionalKevin Marois11-Nov-10 5:39 
QuestionBinding with converter doesn't work. System.Windows.Data.Binding' cannot be converted to type 'System.Windows.Media.Brush'. Pin
ananddayalan2-Nov-10 19:55
ananddayalan2-Nov-10 19:55 
AnswerRe: Binding with converter doesn't work. System.Windows.Data.Binding' cannot be converted to type 'System.Windows.Media.Brush'. Pin
Abhinav S2-Nov-10 21:54
Abhinav S2-Nov-10 21:54 
GeneralRe: Binding with converter doesn't work. System.Windows.Data.Binding' cannot be converted to type 'System.Windows.Media.Brush'. Pin
ananddayalan3-Nov-10 19:26
ananddayalan3-Nov-10 19:26 
GeneralRe: Binding with converter doesn't work. System.Windows.Data.Binding' cannot be converted to type 'System.Windows.Media.Brush'. Pin
ananddayalan3-Nov-10 19:30
ananddayalan3-Nov-10 19:30 
AnswerRe: Binding with converter doesn't work. System.Windows.Data.Binding' cannot be converted to type 'System.Windows.Media.Brush'. Pin
Abhinav S4-Nov-10 4:53
Abhinav S4-Nov-10 4:53 

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.