wpf

Performance comparison of Winforms and WPF

Since XAML gets compiled, there should be no difference in execution of code like this. Winforms (code like): Form formPeter = new Form(); Textbox textbox = new Textbox(); Label l1 = new Label1(); Xaml does not get parsed at runtime, as I thought... :-) But what about rendering/execution of big forms with lot of controls? Which tech...

Dynamic Graph Filtering

Hello, I am working on a graph in WPF, in each section there are thousands of points to draw. The performance for rendering this graph is horrible. Does anyone have any experience with a filter that will represent the graph with much fewer points - similar to the way a stock graph draws itself when its zoomed out. Thank you. ...

How do I determine if a WPF window is modal?

What's the easiest way to figure out if a window is opened modally or not? CLARIFIACTION: I open a window calling myWindow.ShowDialog(); I have a footer with an "OK" & "Cancel" button that I only want to show if the window is opened modally. Now I realize I can set a property by doing this: myWindow.IsModal = true; myWindow.ShowDia...

Automatically focusing parts of a ListBoxItem on selection.

I have a ListBox which is populated from a collection of ViewModels, which uses in place editing, which I do by having a couple of styles which I can apply to parts of the DataTemplate which make them visible/collapsed as required. These look something like: <Style x:Key="UnselectedVisibleStyle" TargetType="{x:Type FrameworkElem...

How to databind to a property on a collection behind a collectionviewsource?

I currently have a collection with a HasChanges property on it (each object in the collection also has its own HasChanges property) and the collection is the source of my CollectionViewSource. When I try to databind the HasChanges property of the collection behind the CollectionViewSource to one of my custom controls, it binds to the Ha...

Why is my typed data template not being applied?

I'm using Linq To Sql to fill up a listbox with Segment objects, where Segment is designer created/ORM generated class. <Window x:Class="ICTemplates.Window1" ... xmlns:local="clr-namespace:ICTemplates" Title="Window1" Height="300" Width="300"> <Window.Resources> <DataTemplate x:Key="MyTemplate"> <!-- <DataT...

How can I mimic this website effect of an expanding and shrinking popup in a WPF application?

Please follow the link http://msdn.microsoft.com/hi-in/default.aspx and see the top right corner of the page. There you will find a "Microsoft.com" expander. When you move the mouse over it, it displays as a popup and grows. When you move your mouse off of it the window shrinks back. I want to mimic this effect in my WPF application us...

Printing/Previewing WPF RichTextBox - ApplicationCommands.PrintPreview?

I'm really loving the WPF RichTextBox, and all of the out-of-the-box functionality it comes with... but printing is something that I'm having trouble with. I can print (from code) using a PrintDialog and passing in my RichTextBox as a Visual (or by using the "Document")... But my question is, is there a simple way to use the application...

WPF Button IsEnabled Based on ComboBox Selection Overwriting default style

I have a Button that is looking at 2 comboboxes to make sure they have a value before it is enabled. The problem is the way I am doing it is overwriting the default style declared in my theme project. <Button x:Name="btnOK" VerticalAlignment="Center" Content="OK" IsDefault="True" Margin="0" Click="btnOK_Click"> <Bu...

TreeListView with Columns generated and populated by ObservableCollection

Does anyone known (or even has an example) of a WPF based TreeListView that can generate its colums by databinding to the ObservableCollection of its tree items? For example the databound model is a tree consisting of Employee instances representing the supervisor hierarchy of a company. Each employee addtionally has a ObservableCollec...

How does one create a WPF MarkupExtension with non-string parameters?

I am working on a Custom MarkupExtension within a WPF application. Every documented example I have seen uses string parameters from XAML to construct the new object. Is it possible to use a non-string parameter? In other words, how can I do something like this? [MarkupExtensionReturnType(typeof(Uri))] public class RefPackUriExtension...

Two 'self-updating' properties in WPF MVVM

Considering you have an MVVM Architecture in WPF like Josh Smith's examples How would you implement two properties 'synced' that update eachother? I have a Price property, and a PriceVatInclusive property in my model. -When the Price changes, I want to see the Vat inclusive price to automatically be 'Price * 1.21'. -Vice versa, when...

Making a control "transparent" to click events

I have a ListBox displaying some items, and in certain modes I "stamp" a kind of watermark across the top of it. I've done this with a Border containing a TextBlock with an Opacity of 0.5. All this works nicely. However, I still want the user to be able to click on the items in the ListBox but if I click on the "stamp" it obviously eats...

WPF FlowDocument Paragraph Inlines Length

Is there any limitations to the WPF Document.Paragraph object when using the FlowDocument control? I have the FlowDocument turning blank when I add a Paragraph that is more than 450 lines to the Paragraph. I could not locate anything within the MSDN documentation regarding max. lengths etc. Any ideas why this would happen? ...

How can I disable horizontal scrolling in a WPF listbox?

This seems to be an absurdly simple question but Google and SO searches yield nothing. How can I disable horizontal scrolling in a WPF listbox when items take up more horizontal space than is available in the box? ...

Where is IsSynchronizedWithCurrentItem property (or equivalent) for a TreeView?

Tell me it ain't so. I have a typical windows/file explorer like setup. Left Side I have a TreeView all data bound showing nodes in a hierachy Right Side I have a ListView showing Node.Properties ListView has a IsSynchronizedWithCurrentItem property, which rocks. e.g. If I had another ListView showing a list of nodes and both listVi...

Localizing a WinForms Application with Embedded WPF User Controls

The application I'm trying to localize is a WinForms application that has a few hosted WPF user controls (WPF user controls hosted in an ElementHost WinForms control). I use resx files to localize the WinForms, which VS2008 manages quite well. The problem starts when I try to use the LocBaml method to localize the WPF parts. Here's wh...

How can you stop an expander in a list box from collapsing when data changes?

I have a screen with a ListBox of items. The item template contains an expander control with some of the data in the header and some of the data in the content part of the expander. The data template for the ListBox ItemTemplate is similar to this: <DataTemplate x:Key="MyTypeTemplate" DataType="{x:Type MyType}"> <Expander DataContex...

Animate ListBoxItem from one ListBox to another ListBox

I would like to create a visual effect when an item in a listbox is double clicked. So far I have drag and drop functionality where the item is visually attached to the mouse and can be moved to a drop target. From that functionality I am able to animate the item using the same logic of getting the item container, however I am not able t...

WPF GridSplitter Doesn't Work With WebBrowser Control?

I've been struggling with the GridSplitter. It seems to be incompatible with the WPF WebBrowser control. If I resize my window and move the GridSplitter, then I can make my grid wider than my window and non-viewable. Before: After: (note scrollbars) My XAML... <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presenta...