渲染內TestEntryView.xaml.cs的ItemsControl用的ItemSource設置爲用戶控件的的ObservableCollection未能在視覺樹
public partial class TestEntryView : UserControl
{
public ObservableCollection<TestFieldView> Fields {get;set;}
...
}
其中TestFieldView是一個用戶控件。
<UserControl x:Class="STS2Editor.View.TestEntryView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:vw="clr-namespace:STS2Editor.View"
mc:Ignorable="d"
x:Name="testEntryView"
d:DesignHeight="300"
d:DesignWidth="427"
d:DataContext="{Binding TestEntry, Source={StaticResource Sample}}">
<Grid Background="{DynamicResource ButtonNormalBorder}" TextElement.Foreground="{DynamicResource TextBrush}">
<Border Background="{DynamicResource ControlBackgroundBrush}" BorderBrush="{DynamicResource ControlBackgroundBrush}" BorderThickness="4" CornerRadius="16">
<Grid Margin="4" >
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<ScrollViewer Background="{DynamicResource ControlBackgroundBrush}" Grid.IsSharedSizeScope="True" Grid.Row="1">
<ItemsControl x:Name="fieldList" ItemsSource="{Binding Fields, ElementName=testEntryView}"/>
</ScrollViewer>
</Grid>
</Border>
</Grid>
結合是正確的,但是當我窺探視覺樹我的子項都包含一個邊框和內容展示,沒有孩子的視覺效果。
這實際上是這樣的!有一次超負荷沒有打電話給我,我現在覺得自己很傻! – Firoso 2010-09-22 22:42:32