wpf

Is Validation called before or after Coercion when setting a DependencyProperty value?

I created a simple class with a DependencyProperty. When setting the value, I observe that ValidateValueCallback is called before CoerceValueCallback. On wpftutorial and in other books, it is stated that coercion is called before validation. ...

Is it possible to define a property on a WPF user control is required?

When creating a WPF user control, is it possible to make a property required via an attribute or other mechanism? ...

Simple WPF sample causes uncontrolled memory growth

I have boiled down an issue I'm seeing in one of my applications to an incredibly simple reproduction sample. I need to know if there's something amiss or something I'm missing. Anyway, below is the code. The behavior is that the code runs and steadily grows in memory until it crashes with an OutOfMemoryException. That takes a while, bu...

Are WPF more 'flashy-like' than winforms?

Hi, I just installed visio, and the installer almost seemed like it was built in flash. The buttons kinda glowed when I hovered over them, and when I clicked on 'continue' the form phased out in a cool way. I'm assuming it was built in WPF. Anyhow, so are WPF more flash-like (visually speaking). Do they have new properties where you c...

Why does handling WM_NCCALCSIZE cause my window to jump?

I have a WPF app which snaps to screen edges (I just set the .Top or .Left of the window if you're within 20 pixels of the screen edge), but I recently added some code provided by the WPF SDK Team to "mess" with the window chrome, and although it's working great (screenshot), it's causing the "snapto" to move the window unexpectedly (e.g...

XPS with Windows Forms

What is the best way to display and print XPS files in a Windows Forms application? ...

How do I handle foreign keys with WPF databinding?

I have a ListView in WPF that is databound to a basic table that I pull from the database. The code for the ListView is as follows: <ListView Canvas.Left="402" Canvas.Top="480" Height="78" ItemsSource="{Binding}" Name="lsvViewEditCardPrint" Width="419"> <ListView.View> <GridView> <GridViewColumn DisplayMemberBinding="{...

Drop Down List with WPF Menu Controls

Hello, I am looking for a way to add a drop down list in WPF to a menu. This used to be really easy in winforms and so I am expecting you experts to know just now to do it in WPF. Thanks. Sorry if this is a bad question, it is late and I don't want to think. ...

Whats the difference between Keyboard.Focus(item) and item.Focus()?

In WPF, there are two ways to set the focus to an element. You can either call the .Focus() method of the input element, or call Keyboard.Focus() with the input element as parameter. // first way: item.Focus(); // alternate way: Keyboard.Focus(item); What is the difference between these two? Are there special reasons to use one of the...

WPF binding with StringFormat doesn't work on ToolTips

The following code has a simple binding which binds the Text of the TextBlock named MyTextBlock to TextBox's Text and ToolTip property using the exact same Binding notation: <StackPanel> <TextBlock x:Name="MyTextBlock">Foo Bar</TextBlock> <TextBox Text="{Binding ElementName=MyTextBlock, Path=Text, StringFormat='It is: \{0\}'}...

How to develop a WPF datagrid control which supports databinding?

I am fairly new to WPF. I want to develop a datagrid control which supports databinding. There is a lot of information available about databinding to existing controls, but I cannot find any information how to develop a control from scratch which supports databinding. I do not expect a simple answer to this question, a link to get me ...

Framerate limit for wpf apps?

hi there, i wonder if there is a way to limit the wpf framerate within a process? i.e. i do not want to limit a single animation's framerate, but the global framerate for my whole application. i think i've seen something like this before but i can't find it anymore. thanks ...

In WPF, has anybody animated a Grid?

I have 2 columns in a Grid. When I click a button, I want the first column to animate to the left from it's current position to 0. So, in effect, it collapses and I'm left with just viewing a single column. ...

Are there problems with rendering WPF over Remote Desktop under Windows XP?

I have heard that WPF primitives will not be supported by remote desktop on windows XP. The implication of this is that if you run a WPF application on a vista machine and display it on an XP machine (via remote desktop) the display will be sent as a compressed bitmap. This issue is resolved in Vista-Vista comunication via DirectX 11 (...

Silverlight Hosted in Winforms

I would like to host a silverlight control in winforms via a winforms browser, but for it to work I need some way for the forms to talk to the silverlight, and also the other way around. Would it be possible to somehow have the two interact with each other using JavaScript as a middleman? I.e., have the form speak to the browser's java...

Nested Scroll Areas

I creating a control for WPF, and I have a question for you WPF gurus out there. I want my control to be able to expand to fit a resizable window. In my control, I have a list box that I want to expand with the window. I also have other controls around the list box (buttons, text, etc). I want to be able to set a minimum size on my c...

How can I add an image to my Run for a RichTextBlock?

I wrote a small WPF app where I like to prepend text into a RichTextBox, so that the newest stuff is on top. I wrote this, and it works: /// <summary> /// Prepends the text to the rich textbox /// </summary> /// <param name="textoutput">The text representing the character information.</param> private void PrependSimpleText(string ...

Resizing XAML properties

Is there a way to have XAML properties scale along with the size of the uielements they belong to? In essence, I have a control template that I have created too large for it's use/ mainly because I want to use the same control with different sizes. The problem is that I can set the control size to Auto (in the ControlTemplate), however ...

What's the difference between StaticResource and DynamicResource in WPF?

When using resources such as brushes, templates and styles in WPF, they can be specified either as StaticResources <Rectangle Fill="{StaticResource MyBrush}" /> or as a DynamicResource <ItemsControl ItemTemplate="{DynamicResource MyItemTemplate}" /> Most of the times (always?), only one works and the other will throw exception du...

Be notified when visual/logical child added/removed

I am currently looking for a way to be notified when a child is added to the visual or logical children. I am aware of the Visual::OnVisualChildrenChanged method, but it does not apply to me since I can't always inherit and override this function. I am looking for an event. So, is there a way for the owner of a FrameworkElement/Visual...