wpf

Windows Forms UserControl overrides not being called

I am creating a Windows Forms control derived from UserControl to be embedded in a WPF app. I have generally followed the procedures given in this link. public ref class CTiledImgViewControl : public UserControl { ... virtual void OnPaint( PaintEventArgs^ e ) override; ... }; And in my CPP file: void CTiledImgViewControl::OnPaint( ...

Asynchronous WPF Commands

Note: The code in this question is part of deSleeper if you want the full source. One of the things I wanted out of commands was a baked design for asynchronous operations. I wanted the button pressed to disable while the command was executing, and come back when complete. I wanted the actual work to be performed in a ThreadPool work ...

WPF Commands and Parameters

I'm finding the WPF command parameters to be a limitation. Perhaps that's a sign that I'm using them for the wrong purpose, but I'm still giving it a try before I scrap and take a different tack. I put together a system for executing commands asynchronously, but it's hard to use anything that requires data input. I know one common pat...

Storyboards cant find ControlTemplate elments.

I've created some fairly simple XAML, and it works perfectly (at least in KAXML). The storyboards run perfectly when called from within the XAML, but when I try to access them from outside I get the error: 'buttonGlow' name cannot be found in the name scope of 'System.Windows.Controls.Button'. I am loading the XAML with a stream read...

Does the GroupBox Header in WPF swallow mouse-clicks?

Hi guys, Have a look at this very simple example WPF program: <Window x:Class="WpfApplication1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300"> <GroupBox> <GroupBox.Header> <Che...

Different item template for each item in a WPF List?

I have many items inside a list control. I want each item to have a different item template depending on the type of the item. So the first item in the list is a ObjectA type and so I want it to be rendered with ItemTemplateA. Second item is a ObjectB type and so I want it to have ItemTemplateB for rendering. At the moment I can only use...

How do I convert an Illustrator file to a path for WPF

Our graphics person uses Adobe Illustrator and we'd like to use her images inside our WPF application as paths. Is there a way to do this? ...

What causes Visual Studio 2008 SP1 to crash when switch to Design View of a WPF application

After developing a WPF application without Source Control, I decided to add the solution to TFS. After doing so whenever I opened the main window.xaml file in Design View Visual Studio would disappear and the following event would be logged in the Application Event log: .NET Runtime version 2.0.50727.3053 - Fatal Execution Engine Er...

Setting WPF dependency property without triggering events

Hi, I need to set a dependency property on a control (Slider.Value) in my code without it triggering a ValueChanged event (since I set the value, not the user). What is the best way to handle this situation in WPF? For clarification, what I am trying to do is hook up WPF sliders to a WinForms User Control. Currently in my app I have a ...

Can You Use A DynamicResource in a Storyboard Contained Within Style Or ControlTemplate

I am trying to use a DynamicResource in Storyboard contained within a ControlTemplate. But, when I try to do this, I get a 'Cannot freeze this Storyboard timeline tree for use across threads' error. What is going on here? ...

Is it possible to ScaleTransform everything on a Canvas/Grid except for 1 Control?

Given the following canvas: <Canvas> <Canvas.LayoutTransform> <ScaleTransform ScaleX="1" ScaleY="1" CenterX=".5" CenterY=".5" /> </Canvas.LayoutTransform> <Button x:Name="scaleButton" Content="Scale Me" Canvas.Top="10" Canvas.Left="10" /> <Button x:Name="dontScaleButton" Content="DON'T Scale Me" Canvas.Top="10" C...

Best way to bind WPF properties to ApplicationSettings in C#?

What is the best way to bind WPF properties to ApplicationSettings in C#? Is there an automatic way like in a Windows Forms Applicatoin? Similar to this question, how (and is it possible to) do you do the same thing in WPF? ...

Difference between a BitmapFrame and BitmapImage in WPF

What is the difference between a BitmapFrame and BitmapImage in WPF? Where would you use each (ie. why would you use a BitmapFrame rather than a BitmapImage?) ...

WPF: Calling TextBox.Clear() from LostFocus handler causes NullReferenceException when window closes

The sample below has two TextBoxes. The second TextBox has a handler for the LostFocus event which calls Clear() on itself. Changing focus between the two text boxes works fine; however, if the focus is on the second text box when the window is closed, TextBox.Clear() generates a NullReferenceException. Is this a bug in WPF? How can...

What's the WPF equivalent of WinForms components?

Windows Forms allows you to develop Components, non-visual elements that can have a designer. Built-in components include the BackgroundWorker, Timer, and a lot of ADO .NET objects. It's a nice way to provide easy configuration of a complicated object, and it it enables designer-assisted data binding. I've been looking at WPF, and it ...

How do you do relative positioning in WPF?

How can you relatively position elements in WPF? The standard model is to use layout managers for everything, but what if you want to position elements (on a Canvas, for example) simply based on the position of other elements? For example, you may want one element (say a button) to be attached the side of another (perhaps a panel) indep...

How do I build a WPF application where I can drag and drop a user control between windows?

I'm building a simple Todo List application where I want to be able to have multiple lists floating around my desktop that I can label and manage tasks in. The relevant UIElements in my app are: Window1 (Window) TodoList (User Control) TodoStackCard (User Control) Window1 looks like this: <Window x:Class="TaskHole.App.Window1" xm...

Setting Focus on a Control within a ControlTemplate in WPF

In an application I'm working on, we have a bunch of custom controls with their ControlTemplates defined in Generic.xaml. For instance, our custom textbox would look similar to this: <Style TargetType="{x:Type controls:FieldTextBox}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Ty...

What is the use of a Dispatcher Object in WPF?

What is the use of a Dispatcher Object in WPF? ...

DependencyProperty and DataBinding?

In WPF: Can someone please explain the relationship between DependencyProperty and Databinding? I have a property in my code behind I want to be the source of my databinding. When does a DependencyProperty (or does it) come into play if I want to bind this object to textboxes on the XAML. ...