WPF

There are 3 entries for the tag WPF

Setting WPF Dialog owner from within WinForms application

I had some WPF dialog that I need to show from older WinForms application, or more precisely from some WinForms UserControl. The problem was to set Owner of that dialog, GetWindow() didn’t work (of course) and leaving dialog without an owner, made it possible to disappear when user switch from application to application. And I didn’t want to show it in task bar either. Thankfully, there is a very easy way, which, for some reason, I didn’t find quite fast – use WindowInteropHelper class. Here is an example: ...

WPF: Adding text as a background of TextBox or ComboBox

One of those small things I liked in Vista is help text in the background of various text boxes, such as Search in Explorer: When you click on it, the text disappears, leave it without typing anything, you again see the text. In many places this might be a useful thing - it helps user to determine what should be written inside and there is no additional place needed to put the label. So I wanted to figure out how to do this in pure XAML without any additional code. It turned out this was pretty...

Loading WPF TreeView dynamically

In WinForms, I used to catch BeforeExpand event of tree view and add additional items on the fly, from database (or any other source of course). So was looking to do the same thing in WPF TreeView and somehow missed the Expanded event of TreeViewItem. You can subscribe to this event in XAML like this: <TreeView TreeViewItem.Expanded="TreeView_Expanded"></TreeView> The rest of code is pretty simple, but if you want to see a full example, look at this post in MSDN forums: Loading TreeView nodes on demand. Technorati Tags: WPF, .NET