wpf

How to handle WndProc messages in WPF?

Finding WPF a steep learning curve. In good ol' Windows Forms, I'd just override WndProc, and start handling messages as they came in. Can someone show me an example of how to acheive the same thing in WPF? ...

Get a Bitmap from a WPF application window?

The Winforms System.Windows.Forms.Control class has an instance method "DrawToBitmap" which I think is very useful in a variety of circumstances. I'm wondering if there's an equivalent way of getting a System.Drawing.Bitmap from a WPF application? I realize I could do some P/Invoke stuff to just get the application window, however I ...

Expression Blend 2/WPF Book

I'm looking for an Expression Blend 2 book that includes best-practices (Expression Blend 2/Visual Studio 2008) designer perspective (Expression Blend 2) programmer perspective (interoperability with Visual Studio 2008) How-To-chapters for Windows Forms developers (how to solve the same problem with WPF) Could you make a recommendat...

VB6 ActiveX Control Inside WPF With Scrollbars

I have some legacy VB6, which I am hosting inside an ActiveX control, which is in my WPF application. Despite putting the control inside of a DockPanel, which is inside a ScrollViewer, the VB6 displays outside the bounds of both, sitting on top of the rest of the application. Does anyone know how I can keep the VB6 inside of the Scroll...

Binding a line to the edge of an ellipse

On a canvas I have an ellipse rotated by a RotateTransform through animation. I wish to add a line with one end attached to a point on the ellipse. Can I somehow bind to a point on the ellipse? ...

Databinding on a IValueConverter

Does anybody know if it is possible to do databinding on an IValueConverter based class? I have the following converter: [ValueConversion(typeof(int), typeof(Article))] public class LookupArticleConverter : FrameworkElement, IValueConverter { public static readonly DependencyProperty ArticlesProperty = DependencyProperty.Register("...

WPF Listbox and keyboard navigation

I have a data-bound ListBox with an ItemTemplate which i want to enable keyboard navigation on. If i didn't use an item template and just used the DisplayMemberPath then the list would be navigable with the keybaord. Pressing 'G' for example, would set the selected item to the first listitem beginning with G. Using an item template ob...

Drag wpf window with thumb: can it be transparent?

I've been testing Blu and I noticed I could drag the window. This window is transparent. I tried to do the same with a Thumb, but I don't know how to put it transparent. The rest of the window is transparent, but the thumb is not. Is there any way to make the thumb transparent, or should I use other technique? I use this event: priva...

Is any source code available that has an Active X control hosted in WPF?

I am looking for some source code and a project to download and look at that has an Active X control hosting WPF. I can not find any source code anywhere on the net. I can not add a WPF resource the usual way in an Active X control. I have to add it manually to the reference section. ...

WPF event property changed?

What interface must i implement to be able to create wpf event when some thing changes? ...

WPF Storyboard Trigger on property changed

Well i have a DataTemplate that is for a class that implements INotifyPropertyChanged is there any way to trigger a storyboard when a property changes and diffrent storeboard on diffrent values (its a bool in this case)? And is there any way to trigger a storyboard on startup depending on values on the class that the datatemplate is mad...

Custom user controls in WPF with vector graphics

I've created the graphics for the user control as a vector graphic and imported it into Expression Design. So far everything worked w/o problems. However I then exported it as XAML and opened it in VS. The XAML consists of a canvas and several Paths. I created a user control in XAML, now I want a mouse click event, which is triggered if ...

Programatically Clear Selection in WPF ComboBox

I have a ComboBox in WPF whose ItemsSource is set to a list programatically. How would I go about clearing the selection in an event handler? I've tried: comboBox.SelectedIndex = -1; comboBox.SelectedItem = null; comboBox.SelectedValue = null; comboBox.SelectedValue = ""; None of them have any effect. ...

How do I prevent a WPF combobox popup from detaching when the combobox is moving?

I've got a textbox stacked on top of a ComboBox. The TextBox gets taller (via animation) when it gets focus, and shrinks back down when it loses focus. The problems start when the TextBox loses focus to the ComboBox. When this happens, the selection Popup (the part that "drops down") appears just below the ComboBox, as expected, but a...

WPF or WinForms for internal tools?

At my company we develop a number of tools for internal that range from simple utilities to full-blown editors. The priorities for these tools are stability, usability, and turn-around time (meaning how quickly new features can be added). We've been using WinForms up until now but there's a couple of new tools on the drawing board and I...

xaml How reference a dynamic resource not as a attribute but as an element

I have an image I need to use in my application in several places. I want to define the image just once in a resource dictionary, and have my other xaml files just that definition. I can The one thing I haven't bee able to figure out is how to reference something defined as a xaml element instead of a attributed inside of a xaml attrib...

Avoiding duplication in WPF (following DRY)

Consider the follow 2 XAML snippets (which are side-by-side in the file): <Button x:Name="BuyButton" Margin="0,0,1,1" IsEnabled="{Binding CanBuy}" > <StackPanel DataContext="{Binding Product}"> <TextBlock Foreground="Red" Text="BUY" /> <TextBlock Foreground="Red" Text="{Binding ...

Usage of DynamicResource to an Application Level Resource Can Cause Leaks

It seems that using a DynamicResource to refer to an application level resource can cause memory leaks to occur. Please see this WPF forum post for more info, how to reproduce it, and some workarounds. My question is: has anyone else run into it? If so, how have you worked around it? By the way, there seem to be many situations where ...

Best practices for using the Entity Framework with WPF DataBinding

I'm in the process of building my first real WPF application (i.e., the first intended to be used by someone besides me), and I'm still wrapping my head around the best way to do things in WPF. It's a fairly simple data access application using the still-fairly-new Entity Framework, but I haven't been able to find a lot of guidance onli...

How can I set a WPF control's color to a system color programatically, so that it updates on color scheme changes?

How can I do this in WPF's code-behind ? <Grid Background="{DynamicResource {x:Static SystemColors.DesktopBrushKey}}"/> ...