相关疑难解决方法(0)

使用PresentationFramework.Aero时,是否需要将"Copy Local"设置为true(并将其包含在我的安装项目中)?

我的WPF项目使用.NET 4客户端配置文件.当我添加

<ResourceDictionary Source="/PresentationFramework.Aero;component/themes/Aero.NormalColor.xaml" />
Run Code Online (Sandbox Code Playgroud)

<Application.Resources>在调试模式下启动程序,当我得到这个异常(在释放模式程序崩溃默默)

PresentationFramework.dll中出现'System.Windows.Markup.XamlParseException'类型的第一次机会异常

附加信息:'Set property'System.Windows.ResourceDictionary.Source'引发了一个异常.行号'14'和行位置'14'.

当我将PresentationFramework.Aero的属性"Copy Local"设置为true时,一切正常,异常就消失了.

"Copy Local"会在我的输出目录中放置PresentationFramework.Aero的副本,因此我需要将它包含在我的安装项目中.为什么这有必要?根据MSDN PresentationFramework.aero包含在.NET framework 4.0客户端配置文件中,因此也包含在GAC中.我觉得在我的应用程序中部署框架文件感觉不舒服.

UDATE:

正如Hans Passant建议我验证目录PresentationFramework.Aero存在于C:\windows\microsoft.net\assembly\gac_msil.然后我使用fuslogvw.exe生成以下日志,在启动我的应用程序"SetACL Studio.exe"时创建,而ApplicationFramework.Aero.dll不在应用程序目录中.有趣的是,加载器甚至没有检查GAC.为什么?

*** Assembly Binder Log Entry  (18.11.2011 @ 17:13:27) ***

The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Running under executable  D:\Daten\Helge\Programmierung\SetACL Studio\Source\Bin\Debug\SetACL Studio.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: User = HKT520\Helge
LOG: …
Run Code Online (Sandbox Code Playgroud)

.net wpf gac

11
推荐指数
1
解决办法
1万
查看次数

WPF Windows 8兼容性问题

给定一个按钮(或组合框,或任何控件):

<Button x:Name="button" Command="{Binding DoStuff}" Margin="10,0,5,5" Content="Do Stuff!" Style="{StaticResource buttonDefaults}"/>
Run Code Online (Sandbox Code Playgroud)

随风格:

<Style x:Key="buttonDefaults" TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
        <Style.Resources>
            <ResourceDictionary Source="/PresentationFramework.Aero;component/themes/Aero.NormalColor.xaml"/>
        </Style.Resources>
        <Setter Property="Background">
            <Setter.Value>
                <RadialGradientBrush>
                    <GradientStop Color="#F4083268" Offset="1"/>
                    <GradientStop Color="#FE5C9247"/>
                </RadialGradientBrush>
            </Setter.Value>
        </Setter>
        <Setter Property="BorderBrush" Value="Transparent"/>
        <Setter Property="Foreground" Value="White"/>
        <Setter Property="FontFamily" Value="Arial"/>
        <Setter Property="FontSize" Value="16"/>
        <Setter Property="Focusable" Value="False"/>
    </Style>
Run Code Online (Sandbox Code Playgroud)

它在Windows 8中看起来与在Windows 7中看起来非常不同.

现在,奇怪的是,在DESIGNER中,一切在Windows 8机器上看起来都很完美,就好像它是Windows 7 ......但在运行时,风格并没有"应用".

另一方面,它在设计器和运行时的Windows 7上看起来都很完美.有没有办法来解决这个问题?

额外细节:

随着风格的RD:

    <Style x:Key="buttonDefaults" TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
        <Style.Resources>
            <ResourceDictionary Source="/PresentationFramework.Aero,Version=4.0.0.0,Culture=Neutral,PublicKeyToken=31bf3856ad364e35,processorArchitecture=MSIL;component/themes/Aero.NormalColor.xaml"/>
        </Style.Resources>
        <Setter Property="Background">
            <Setter.Value>
                <RadialGradientBrush>
                    <GradientStop Color="#F4083268" Offset="1"/>
                    <GradientStop Color="#FE5C9247"/>
                </RadialGradientBrush> …
Run Code Online (Sandbox Code Playgroud)

c# wpf compatibility xaml resourcedictionary

5
推荐指数
1
解决办法
1476
查看次数

标签 统计

wpf ×2

.net ×1

c# ×1

compatibility ×1

gac ×1

resourcedictionary ×1

xaml ×1