本文介绍了PresentationTraceSources.TraceLevel = High的任何原因都不会将任何信息打印到输出窗口中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直试图解决绑定我的ComboBox的SelectedItem的问题,因为我没有成功,所以我开始研究如何通过设置 PresentationTraceSources来获取更详细的调试信息。 TraceLevel = High 用于特定绑定。不幸的是,在这样做之后,我在Oupup窗口中没有看到任何相关项目在Debug类别下。



我使用的是Visual Studio 2010,我的项目是一个WinForms项目大量使用Interop使用ElementHost来承载WPF内容。目前正在为.NET 3.5构建所有相关项目。任何可能导致我在输出窗口中查看额外跟踪信息的想法或建议将不胜感激。



以下是我的代码片段使用。

 < ComboBox xmlns:diagnostics =clr-namespace:System.Diagnostics; assembly = WindowsBase

ItemsSource ={Binding MyCollection,diagnostics:PresentationTraceSources.TraceLevel = High}
SelectedValuePath ={Binding Path = MyCollection.SelectedItem,Mode = TwoWay,diagnostics:PresentationTraceSources.TraceLevel = Value
DisplayMemberPath =Value.DisplayName/>


解决方案

这是Visual Studio 2010中的一个设置: p>

工具 - > 选项 - > 调试 - > - > WPF跟踪设置 - > 数据绑定 - >设置为警告(或任何你喜欢的)。
$ b

标准已关闭。



此解决方案适用于我。


I've been trying to get to the bottom of an issue with binding the SelectedItem of my ComboBox and since I've had not success thusfar I started looking at ways to get more detailed debugging information by setting PresentationTraceSources.TraceLevel=High for specific bindings. Unfortunately after doing so I don't see any related items in my Ouput window under the Debug category.

I'm using Visual Studio 2010 and my project is a WinForms project with heavy usage of interop using ElementHost to host WPF content. All related projects are currently being built for .NET 3.5. Any thoughts or suggestions that may lead me to the solution of seeing the extra trace information in the output window will be appreciated.

Below is a snippet of the code I'm using.

<ComboBox xmlns:diagnostics="clr-namespace:System.Diagnostics;assembly=WindowsBase"
            SelectedItem="{Binding Path=MyCollection.SelectedItem, Mode=TwoWay, diagnostics:PresentationTraceSources.TraceLevel=High}"
            ItemsSource="{Binding MyCollection, diagnostics:PresentationTraceSources.TraceLevel=High}"
            SelectedValuePath="Value"
            DisplayMemberPath="Value.DisplayName" />
解决方案

It's a setting in the Visual Studio 2010:

Tools -> Options -> Debugging -> Output Window -> WPF Trace Settings -> Data Binding -> set to Warning (or whatever you like).

Standard was Off.

This solution worked for me.

这篇关于PresentationTraceSources.TraceLevel = High的任何原因都不会将任何信息打印到输出窗口中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 17:30