gpt4 book ai didi

wpf - Silverlight 错误 : AG_E_UNKNOWN_ERROR

转载 作者:行者123 更新时间:2023-12-05 00:42:55 28 4
gpt4 key购买 nike

我收到了 AG_E_UNKNOWN_ERROR运行我的 Silverlight 项目时。该项目是从 WPF 移植的,从我在网络上收集到的内容来看,我认为它与我的 XAML 中的某些无效内容有关

编辑 C# 控制源可以在这里找到:SilverlightCalendar/Controls

这是 Generic.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>

最佳答案

最近调试了一堆这些。当我看不到问题时,我只注释 XAML 的大部分内容,直到我没有收到错误,然后取消注释部分,直到找到导致异常的位置。

编辑:对于初学者来说,去掉 TargetType="{c:CalendarTimeslotItem}" 中的大括号.刚刚尝试过,我以这种方式得到了异常。只需使用 TargetType="c:CalendarTimeslotItem"

关于wpf - Silverlight 错误 : AG_E_UNKNOWN_ERROR,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1661121/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com