sl4+xml出错
xml文件
<root>
<node title="http://www.baidu.com" address='http://www.baidu.com' >
<node title="http://www.baidu.com" address='http://www.baidu.com' />
<node title="http://www.baidu.com" address='http://www.google.com' />
<node title="http://www.baidu.com" address='http://www.news.cn' />
</node>
</root>
xaml内容:
<UserControl x:Class="jac_web.TreeView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
xmlns:uriMapper="clr-namespace:System.Windows.Navigation;assembly=System.Windows.Controls.Navigation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
xmlns:common="clr-namespace:System.Windows;assembly=System.Windows.Controls">
<Grid x:Name="LayoutRoot" Background="White" Height="335" Width="576">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120*" />
<ColumnDefinition Width="1" />
<ColumnDefinition Width="302*" />
</Grid.ColumnDefinitions>
<Rectangle Grid.Column="1" Fill="Blue" ></Rectangle>
<StackPanel HorizontalAlignment="Left" Margin="5" x:Name="navigation" VerticalAlignment="Top" >
<StackPanel.Resources>
<common:HierarchicalDataTemplate x:Key="childTemplate">
<TextBlock Text="{Binding Path=Address}" ></TextBlock>
</common:HierarchicalDataTemplate>
<common:HierarchicalDataTemplate ItemsSource="{Binding Path=Children}" ItemTemplate="{StaticResource childTemplate}" x:Key="treeTemplate">
<TextBlock Text="{Binding Path=Address}"></TextBlock>
</common:HierarchicalDataTemplate>
</StackPanel.Resources>
<controls:TreeView x:Name="treeView"
ItemsSource="{Binding}"
ItemTemplate="{StaticResource treeTemplate}"
SelectedItemChanged="treeView_SelectedItemChanged" Height="284" Width="155">
</controls:TreeView>
</StackPanel>
<navigation:Frame x:Name="frame" Grid.Column="2" Grid.Row="1" JournalOwnership="UsesParentJournal" />
</Grid>
</UserControl>
xaml.cs代码:
实体类:
public class TreeViewModel
{
public Uri Title { get; set; }
public string Address { get ; set ; }
public List<TreeViewModel> Children { get; set; }
}
错误:
uri无法加载 URI 的内容。URI 可能无效。