当我运行我的Silverlight项目时,出现了一个
AG_E_UNKNOWN_ERROR
错误。该项目是从WPF移植而来的,从网上收集到的信息来看,我认为这可能与我的XAML中的某些无效内容有关。
编辑:C#控件源代码可在此处找到:SilverlightCalendar/Controls
这是我的应用程序的通用.xaml文件,其中包含样式。<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:c="clr-namespace:SilverlightCalendar.Controls">
<Style TargetType="{c:CalendarTimeslotItem}">
<Setter Property="Content" Value="{Binding}" />
<Setter Property="Background" Value="White" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{c:CalendarTimeslotItem}">
<Border Background="{TemplateBinding Background}"
BorderBrush="#A5BFE1"
BorderThickness="0,0.5,0,0.5"
x:Name="bd"
Height="22">
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{c:CalendarLedgerItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{c:CalendarLedgerItem}">
<Border Background="#E3EFFF"
BorderBrush="#6593CF"
BorderThickness="0,0,1,1"
Height="44" Width="50">
<StackPanel Orientation="Horizontal"
VerticalAlignment="Center"
HorizontalAlignment="Center">
<TextBlock Text="{TemplateBinding TimeslotA}"
Foreground="#9493CF" FontSize="16" Margin="0,3,0,0"/>
<TextBlock Text="{TemplateBinding TimeslotB}"
Foreground="#9493CF" Margin="1.5,0,0,0"/>
</StackPanel>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{c:CalendarDay}">
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<c:TimeslotPanel />
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{c:CalendarDay}">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<Grid>
<StackPanel x:Name="PART_CalendarTimeslots" />
<ItemsPresenter />
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{c:CalendarLedger}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{c:CalendarLedger}">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<StackPanel x:Name="PART_CalendarLedgerItems" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{c:Calendar}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{c:Calendar}">
<Border Background="#E3EFFF"
BorderBrush="#6593CF"
BorderThickness="2,2,2,2">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Border BorderBrush="#6593CF" BorderThickness="0,0,0,1"
Grid.Column="0" Grid.Row="1" />
<Border BorderBrush="#6593CF" BorderThickness="0,0,0,1"
Grid.Column="1" Grid.Row="1" />
<ScrollViewer Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<c:CalendarLedger Grid.Column="0" />
<c:CalendarDay Grid.Column="1" x:Name="PART_CalendarDay" />
</Grid>
</ScrollViewer>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{c:CalendarAppointmentItem}">
<Setter Property="StartTime" Value="{Binding StartTime}" />
<Setter Property="EndTime" Value="{Binding EndTime}" />
<Setter Property="Width" Value="{Binding ActualWidth, ElementName=CalendarTimeslots}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{c:CalendarAppointmentItem}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="300" />
<ColumnDefinition Width="300" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Border Grid.Row="0"
Grid.Column="{Binding Column}"
Grid.ColumnSpan="{Binding ColumnSpan}"
CornerRadius="4,4,4,4"
BorderThickness="1,1,1,1"
BorderBrush="#5D8CC9"
Background="{Binding Background}"
Margin="1,1,5,1"
Padding="5,5,5,5">
<Border.Effect>
<DropShadowEffect Opacity="0.5" />
</Border.Effect>
<TextBlock
IsHitTestVisible="False"
Foreground="{Binding Foreground}"
VerticalAlignment="Top"
MaxHeight="20"
LineHeight="20"
FontFamily="Segoe UI"
FontSize="12.75"
FontWeight="DemiBold"
FontStretch="Medium"
TextWrapping="WrapWithOverflow"
Text="{Binding Subject}" />
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>