问题标签 [xamlparseexception]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
c# - Windows XP 上的 XamlParseException
我有一个 WPF 应用程序,它在 vista/7 上运行得非常好,但在 Windows XP 上它会抛出 System.Windows.Markup.XamlParse 错误,这非常令人沮丧,因为我的应用程序中有很多控件,而我没有'不知道是什么导致了问题。
任何人都可以在这里发光吗?
xaml - XAML 序列化对象不使用 asp.net 卷影副本
我有一个问题,我将 XAML 序列化器/反序列化器用于我拥有的配置类型文件。我遇到的问题是 XAML 序列化程序正在从 /Bin 目录中的程序集返回对象,而 Web 应用程序的其余部分正在使用存储在 ..../Temporary Files/.. 目录中的程序集。
有什么办法可以防止这种情况发生吗?这是 XAML 序列化程序/程序集加载例程中的错误吗?
每次编译时,我都需要停止并启动 asp.net 应用程序,因此卷影副本和 bin 是完全相同的文件。即使不更改 dll 并重新编译仍然会导致问题。
关于如何解决这个问题的任何想法?
目前我已经尝试关闭卷影复制,但是我每次编译时都需要关闭/启动 Web 应用程序。
帮助!
xaml - 如何在 Xaml 元素中填充多个集合属性
我正在创建一个继承自System.Windows.Documents.Paragraph
并添加新集合属性的类。这是该类的非常简化的表示:
我需要在 Xaml 中创建和填充上述类的一个实例,这需要一种标记语法,允许单独声明段落的内容及其 Attributes 集合的成员。
由于 Paragraph 类是用 attribute 装饰的[ContentProperty("Inlines")]
,我假设我需要显式地填充 Inlines 和 Attributes 集合。基于我在其他地方看到的用于解决类似挑战的 Xaml 语法,我设想这样的事情:
但是,这种方法存在两个问题:
[1] 使用 XamlReader 解析上述 Xaml 时,失败并显示消息“ExtendedParagraph.Inlines 属性已设置且只能设置一次”
[2] 我不确定应该使用什么标记在 Attributes 元素中声明 KeyValuePair 的实例。
我希望有人能指出我正确的方向。
非常感谢,蒂姆
编辑 - 我找到了问题 [1] 的答案。它只需要首先声明 Attributes 集合(使用属性元素语法),然后是段落的内容:
然而,以声明方式将成员添加到 aDictionary<TKey, TValue>
被证明更加困难。我在这篇文章中找到了一些线索,但我还没有取得工作成果。您的想法仍然受到欢迎。
c# - XamlParseException 由于来自 WPFToolKit 的 DatePicker
错误:UnhandledException:System.Windows.Markup.XamlParseException:“/WPFToolkit;component/DataGrid/Themes/Luna.NormalColor.xaml”值无法分配给对象“System.Windows.ResourceDictionary”的属性“Source”。
我不断收到以下异常。当我从 Release 文件夹运行应用程序 exe 时出现异常。在 Visual Studio 中正常调试应用程序时,我根本没有遇到异常。我已经确定异常是因为我正在使用 DatePicker 控件 - 好像我删除了控件(再次构建并运行发布 exe)异常消失了。
我到底怎么能弄清楚这里出了什么问题?
日期选择器看起来好多了,但是对于这看起来可能要修复的工作,我可能倾向于切换到一个文本框,我在按下提交按钮时验证该文本框!令人失望...
wpf - clickonce部署后xamlparser错误。安装后应用程序崩溃
我已经用 Visual Studio 2008 构建了一个 WPF 应用程序并为其创建了一个安装程序。到目前为止工作正常。我意识到它缺乏自动更新功能,在尝试了几种解决方案后,我决定尝试 clickonce 部署。经过在网络服务器上成功部署,我注意到安装下载的应用程序后应用程序崩溃。它抱怨这个:
无法创建在程序集“MyApplication,Version=1.0.0.0,Culture=neutral,PublicKeyToken=null”中定义的“Login”实例。调用的目标已引发异常。标记文件“MyApplication;component/login.xaml”第 1 行位置 9 中的错误。
这是堆栈跟踪
在 System.Windows.Markup.XamlParseException.ThrowException(字符串消息,异常 innerException,Int32 lineNumber,Int32 linePosition,Uri baseUri,XamlObjectIds currentXamlObjectIds,XamlObjectIds contextXamlObjectIds,Type objectType)
在 System.Windows.Markup.XamlParseException.ThrowException(ParserContext parserContext,Int32 lineNumber, Int32 linePosition, String message, Exception innerException) at System.Windows.Markup.BamlRecordReader.ThrowExceptionWithLine(String message, Exception innerException)
at System.Windows.Markup.BamlRecordReader.CreateInstanceFromType(Type type, Int16 typeId, Boolean throwOnFail)
在 System.Windows.Markup.BamlRecordReader.GetElementAndFlags(BamlElementStartRecord bamlElementStartRecord, Object& element, ReaderFlags& flags, Type& delayCreatedType, Int16& delayCreatedTypeId)
在 System.Windows.Markup.BamlRecordReader.BaseReadElementStartRecord(BamlElementStartRecord bamlElementRecord)
在 System.Windows.Markup.BamlRecordReader.ReadElementStartRecord (BamlElementStartRecord bamlElementRecord)
在 System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord)
在 System.Windows.Markup.BamlRecordReader.Read(Boolean singleRecord)
在 System.Windows.Markup.TreeBuilderBamlTranslator.ParseFragment()
在 System.Windows.Markup .TreeBuilder.Parse()
在 System.Windows.Markup.XamlReader.LoadBaml(流流,ParserContext parserContext,对象父级,布尔 closeStream)
在 System.Windows.Application.LoadBamlStreamWithSyncInfo(流流,ParserContext pc)
在 System.Windows.Application.LoadComponent(Uri resourceLocator, Boolean bSkipJournaledProperties)
at System.Windows.Application.DoStartup()
at System.Windows.Application.<.ctor>b__0(Object used)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(对象源,委托回调,对象参数,布尔 isSingleParameter,委托 catchHandler)
在 System.Windows.Threading.Dispatcher.WrappedInvoke(委托回调,对象参数,布尔 isSingleParameter,委托 catchHandler)
在 System.Windows.Threading.DispatcherOperation.InvokeImpl() 在
System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(对象状态)
System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback 回调,对象状态)
在 System.Windows.Threading.DispatcherOperation.Invoke()
在 System.Windows.Threading.Dispatcher.ProcessQueue()
在 System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& 处理)
在 MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&handled)
在 MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(委托回调, System.Windows.Threading.ExceptionWrapper.TryCatchWhen 处的对象 args,布尔 isSingleParameter)
(对象源,委托回调,对象 args,布尔 isSingleParameter,委托 catchHandler)
在 System.Windows.Threading.Dispatcher.WrappedInvoke(委托回调,对象参数,布尔 isSingleParameter,委托 catchHandler)
在 System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority 优先级,TimeSpan 超时,委托方法,对象参数,布尔 isSingleParameter)
在MS.Win32.HwndSubclass.SubclassWndProc
(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
在 MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
在 System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame 框架)
在 System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame 框架)
在 System.Windows.Threading.Dispatcher.Run()
在 System.Windows.Application.RunDispatcher(Object ignore)
在 System.Windows.Application.RunInternal(Window window)
在 System.Windows.Application.Run(Window window)
在 System .Windows.Application.Run()
在 myApplication.App.Main()
这只是调试器指向的区域
但是安装项目中的 msi 中的安装程序版本工作正常。所以我看不到错误来自哪里,因为我可以有设计视图。
问题1:有没有人有类似的问题,或者这是一个已知的问题?
问题 2:如果这是一个已知问题,那么还有什么可供选择的。我可能会放弃点击,但我的自动更新功能将丢失(因为没有我现在可以找到的不是过时或严重过时的) .
感谢您阅读本文并为我指明正确的方向。
.net - 在 CodeBehind 中设置 ContentTemplate:XamlParseException 2260 错误
我想更改 CodeBehind 文件中 ContentPresenter 的 ContentTemplate。但是,如果我运行 Silverlight 4 应用程序,则会发生带有错误代码 2260 的 XamlParseException。
如果我只做 foreach 代码而没有“if”中的代码,它就可以工作。如果我只在没有 foreach 的情况下在“if”中编写代码,它也可以工作。但是一起(“if”代码和 foreach 代码)它不起作用。
我不知道为什么它不起作用。这两个模板如下所示:
如果您知道是什么问题,请告诉我。
silverlight - Silverlight 4:尝试与样式和资源绑定时出现 XamlParseException
我正在使用 Silverlight 4,并且正在尝试从 4 月开始集成 Silverlight 4 工具包中的主题之一。
我的 App.xaml 内容如下:
当我的主窗口显示
它完美地工作。但是我想使用资源,所以我继续执行以下操作
它失败 :-(
我试图将资源样式放在其他地方,如 App.xaml 等。
任何人都知道我可以如何使用资源,所以我不必为每个 TextBlock 指定前景?
PS - 我正在使用 ExpressionDark 主题...
提前致谢,
麦克风
silverlight - Silverlight 4 ManagedRuntimeError 4004 列表框滚动图像 XamlParseException
Silverlight 4 让我崩溃了。即时调试器说:
我将一个列表框绑定到 20 个(左右)项目的集合。集合加载正常并正确绑定。但是,当我滚动到集合的底部,然后尝试向上滚动silverlight 崩溃。
仅当我在项目模板中包含 contentcontrol、contentpresenter 或图像控件时才会出现该错误。例如,如果我将“InnerBorder”高度设置为 100 并删除内容控件,silverlight 将不会崩溃。此外,{Binding Visual} 是在项目的视图模型上定义的图像。
这是我的代码。
我完全迷路了。任何帮助将不胜感激。
c# - 如何在 Silverlight 中的附加依赖项属性上设置 TypeConverter?
我的目标是能够用 XAML 编写它:
问题: Silverlight XAML 无法从字符串中解析 DateTime。所以在运行时我有 XamlParseException “无法从该字符串创建 DateTime”。
当我使用简单的 DependencyProperty 时,我只需在 getter/setter 上添加一个 TypeConverterAttribute 即可。像这样(来自这里的想法):
但是使用附加的DP,就没有 getter/setter。我该怎么做才能在 XAML 中写入字符串日期?
谢谢 !
silverlight - 具有内部自定义控件的默认样式 (C# Silverlight)
System.Windows.Controls.Control
我正在尝试创建一个派生自with visibility的 Silverlight 自定义控件internal
,但是在尝试应用默认样式时遇到了问题。这是该类的最简单形式...
generic.xaml
...这是...中默认样式的一种简单形式
虽然这个控件没有做任何有用的事情,但可以创建它的一个实例,但前提是它的可见性是public
. 当类被标记internal
时,应用程序会引发以下运行时错误:
您能否告知我需要做什么才能使内部控制类对 Xaml 解析器可见。
谢谢,蒂姆