sl4+xml出错

kaifa123 2010-12-27 04:34:28
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 可能无效。
...全文
54 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
passself 2010-12-27
  • 打赏
  • 举报
回复
楼主应该是和xml解析方式有误才会出现这种情况

4,328

社区成员

发帖
与我相关
我的任务
社区描述
多媒体/设计 Flex
社区管理员
  • Flex
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧