TraceOutputControl

The TraceOutputControl will be removed in Catel v5.0. It is deprecated and replaced by the LogViewerControl in Orc.Controls.

TraceOutputControl is a debugging convenience control. It shows all the trace and logging output in a filterable control. This way, you can easily view all the binding errors, etc., in your app instead of the non-colored output window in Visual Studio.

 

XAML sample

<Controls:TraceOutputControl />

C# sample

var TraceOutputWindow = new Window();
TraceOutputWindow.Height = 300;
TraceOutputWindow.Width = 500;

Catel.Windows.Controls.TraceOutputControl NewTraceControl = new TraceOutputControl();
var NewGrid = new StackGrid();
NewGrid.Children.Add(NewTraceControl);
TraceOutputWindow.Content = NewGrid;
TraceOutputWindow.Show();

ILog Log = LogManager.GetCurrentClassLogger(); // Turning this into a public static might be a good ideia

Log.Info("Hi! I am an INFO log entry");
Log.Warn("Hi! I am an WARN log entry");
Log.Error("Hi! I am an ERROR log entry");

Many times, developers are inside an application viewing the result of what they have created. But, they also want to know what is happening in the background and view the traces they have written. The output window of Visual Studio is a solution, but it doesn’t show errors very well (black, just as the normal output). Also, it doesn’t allow run-time filtering of the results.

The TraceOutputControl allows a developer to embed a control inside a window or control in the actual application and view the information when the application is actually running. The TraceOutputControl is also available as a separate window in case it can’t be embedded into the software itself (for example, when a plug-in is being developed for a 3rd party application).

 The TraceOutputControl subscribes a custom TraceListener to the Trace.Listeners collection. Then, it filters out the messages that the user actually wants to see and stores these messages into an internal collection so the user can still filter the messages at a later time.

Starting with Catel 4.0, the TraceOutputControl uses the logging system in Catel to display both log and trace messages