Reputation: 1125
I'm starting to develop a simple application in VS9 and I decided to use WPF and the MVVM paradigm for it.
Still being a bit unexperienced with VS deveopment in general and WPF-controls in peculiar, I would like to ask how I should proceed to establish a little debug console window that takes perhaps 1/4 of the main window and sits kind of docked in the bottom of the window.
I would use it for writing trace or debug messages into it while my application runs or while I'm debugging it in the development phase.
Anyway, what type of control should I use and how do I write to it?
Alternatively I was thinking of using a Console window separately from my WPF application but that wouldn't be so desirable, actually.
-- Chris
Upvotes: 2
Views: 2856
Reputation: 86729
Rather than write logging messages to a window:
If you do want to write messages to a window or console in your application, then the recommendation would be to use a separate window - that way the presence of the console / debug window doesn't affect the layout of your main window.
As for getting a debug console to "stick" to the bottom of your window, take a look at some articles (or perhaps a book) on layout in wpf, and get used to how the layout system works in wpf.
http://learnwpf.com/Posts/Post.aspx?postId=c76411d6-5350-4a10-b6bb-f1481c167ecf
http://www.codeproject.com/KB/WPF/BeginWPF1.aspx
http://www.aspfree.com/c/a/Windows-Scripting/WPF-Control-Layout/
You should probably be able to get the desired effect using a Dock Panel
Upvotes: 2
Reputation: 176169
A very basic method is to use System.Diagnostics.Trace
for writing out debug messages. You can attach to these messages with a TraceListener
as described here, or you can use a separate tool such as DebugView to display these messages. Please note that while debugging, trace messages will also be displayed in Visual Studio's Output window.
Upvotes: 0