我目前正在调查在Expression Blend 4中的Silverlight项目中构建用户控件。该控件具有用于用户控件的相关联的一组示例数据,并且数据在用户控制。MainPage.xaml中的Silverlight用户控件
当我将用户控件放在主页上时,示例数据不会出现在用户控件中。这是正确的行为,还是我设置/不设置的东西?我发现奇怪的是,当我编辑用户控件时,数据与重建指示符(黄色感叹号)一起出现在主页面中。当我重建时,数据再次消失。
这是主页代码:
<UserControl
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:SilverlightApplication2" mc:Ignorable="d"
x:Class="SilverlightApplication2.MainPage"
Width="1200" Height="640">
<UserControl.Resources>
<local:MultiDayViewModel x:Key="MultiDayViewModelDataSource" d:IsDataSource="True"/>
</UserControl.Resources>
<Grid x:Name="LayoutRoot" Background="White" d:DataContext="{d:DesignData /SampleData/TestSampleData.xaml}">
<Grid.RowDefinitions>
<RowDefinition Height="0.128*"/>
<RowDefinition Height="0.872*"/>
</Grid.RowDefinitions>
<StackPanel Margin="0,24,8,8" HorizontalAlignment="Right" Width="318" Orientation="Horizontal">
<Button Content="Daily"/>
<Button Content="Weekly"/>
</StackPanel>
<local:MultiDayView x:Name="MultiDayView" Margin="8" Grid.Row="1" DataContext="{Binding Calenar, Source={StaticResource MultiDayViewModelDataSource}}"/>
</Grid>
任何想法或方向将不胜感激。
谢谢。
运行时也不会显示示例数据。我将这个问题作为一个单独的问题提出,但我感觉这两个问题是相关的。任何线索? – Jason 2010-10-20 03:37:25