霸王硬上弓:不熟Silverlight,确要做LightSwitch扩展,问关于TreeView的一个问题

wumylove1234 2012-11-03 07:44:01

<UserControl x:Class="ProjectExtension.Presentation.Controls.TreeControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ProjectExtension"
xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">

<UserControl.Resources>
<local:EntityCollectionValueConverter x:Key="EntityCollectionValueConverter" />
<sdk:HierarchicalDataTemplate x:Key="HTemplate"
ItemsSource="{Binding Converter={StaticResource EntityCollectionValueConverter}, ConverterParameter=Categories}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Path=CategoryName, Mode=TwoWay}"
Margin="5,0" Width="74" />
</StackPanel>
</sdk:HierarchicalDataTemplate>
</UserControl.Resources>

<Grid DataContext="{Binding Value}" x:Name="LayoutRoot" Background="White">
<StackPanel Orientation="Horizontal">

<sdk:TreeView Name="treeViewControl" ItemsSource="{Binding}" SelectedItemChanged="treeViewControl_SelectedItemChanged" ItemTemplate="{StaticResource HTemplate}">

</sdk:TreeView>

</StackPanel>
</Grid></UserControl>


我需要在后台代码中动态控制两个地方:
1、<sdk:HierarchicalDataTemplate x:Key="HTemplate"
ItemsSource="{Binding Converter={StaticResource EntityCollectionValueConverter}, ConverterParameter=Categories}">
其中的Categories我需要动态赋值

2<TextBlock Text="{Binding Path=CategoryName, Mode=TwoWay}"
Margin="5,0" Width="74" />

其中的Path属性我需要在后台代码中进行赋值。

完全不懂Silverlight,在后台代码中根本找不到这两个东西的引用,如何来搞呀?急呀~~
...全文
944 1 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
wumylove1234 2012-11-03
  • 打赏
  • 举报
回复
就是<sdk:HierarchicalDataTemplate x:Key="HTemplate" ItemsSource="{Binding Converter={StaticResource EntityCollectionValueConverter}, ConverterParameter=}"> 其中的Categories我需要动态赋值 2<TextBlock Text="{Binding Path=, Mode=TwoWay}" Margin="5,0" Width="74" /> 就是这两个?号的地方,需要在后台代码里动态指定,有没有办法呀?

8,756

社区成员

发帖
与我相关
我的任务
社区描述
WPF/Silverlight相关讨论
社区管理员
  • WPF/Silverlight社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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