wpf

Using XAML + designer to edit Plain Old CLR Objects?

I want to write a POCO in XAML, and use a DataTemplate to display that object in the GUI at runtime. So far, so good; I know how to do all that. Since I'll already have a DataTemplate that can transform my POCO into a WPF visual tree, is there any way to get the Visual Studio designer to play along, and have the Design View show me the ...

Reporting options for a WPF application?

I'd like to integrate some high-level reports into my WPF application. Essentially, the user will enter some parameters, press a "Go" button, and will be presented with their report. A report will consist of some text, some tables and some charts. What technologies, tools and libraries are available to my WPF application? ...

Is it possible to implement smooth scroll in a WPF listview?

Is it possible to implement smooth scroll in a WPF listview like how it works in Firefox? When the Firefox browser contained all listview items and you hold down the middle mouse button (but not release), and drag it, it should smoothly scroll the listview items. When you release it should stop. It looks like this is not possible in win...

Drag and Drop in MVVM with ScatterView

I'm trying to implement drag and drop functionality in a Surface Application that is built using the MVVM pattern. I'm struggling to come up with a means to implement this while adhering to the MVVM pattern. Though I'm trying to do this within a Surface Application I think the solution is general enough to apply to WPF as well. I'm tr...

How can I make a WPF combo box have the width of its widest element in XAML ?

I know how to do it in code, but can this be done in XAML ? Window1.xaml: <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"> <Grid> <ComboBox Name="ComboBox1" ...

How do I properly add a prefix (or suffix) to databinding in XAML?

How do I databind a single TextBlock to say "Hi, Jeremiah"? <TextBlock Text="Hi, {Binding Name, Mode=OneWay}"/> Looking for an elegant solution. What is out there? I'm trying to stay away from writing a converter for each prefix/suffix combination. ...

New features of WPF 4?

Hi, I've been unable to find articles describing in any detailed manner the new features of WPF in .Net 4.0. Where could I find that? Thanks! ...

Firing a double click event from a WPF ListView item using MVVM

In a WPF application using MVVM, I have a usercontrol with a listview item. In run time, it will use databinding to fill the listview with a collection of objects. What is the correct way to attach a double click event to the items in the listview so that when an item in the list view is doubleclicked, A corresponding event in the view ...

[WPF] What is the best way to draw text along with geometry?

In WPF, I'm starting to use classes such as LineGeometry, EllipseGeometry, GeometryGroup, Path... in order to draw 2D graphics. I chose these over shapes because I saw it could be faster thanks to the freezing feature. I need to draw text along with geometry, with specific fonts. The text needs to be positionnable with the same coordina...

What is best practice to handle all Exceptions in WPF application?

HiIs there any way to handle all Errors Exceptions and crashes in WPF application? I know about DispatcherUnhandledException, but it handles only exceptions in UI thread, isn't it? Is there a way to catch and log all exceptions in other threads? and binding errors too? How do you implement this kind of requirement in your enterprice syst...

ImageSourceConverter throws a NullReferenceException ... why?

I've been tearing my hair out over this issue for the last hour or so. I have some code that goes like this: videoTile.Icon = new ImageSourceConverter().ConvertFrom(coDrivr4.Properties.Resources.Music.GetHbitmap()) as ImageSource; When I run my code, it says a NullReferenceException occurred. Neither 'Music' nor the return of GetHbit...

MVVM - Controls versus Views

I've been doing a prototype in WPF without using MVVM. It's got to such a size now that I'm refactoring it to use MVVM. When I started the project, I jumped straight in and created UserControls for lots of things. I'm now breaking things in Views and ViewModels. But, I'm ending up with Views that contain UserControls; the UserControl...

Synchronizing WPF control widths in a WrapPanel

I have this case <WrapPanel> <CheckBox>Really long name</CheckBox> <CheckBox>Short</CheckBox> <CheckBox>Longer again</CheckBox> <CheckBox>Foo</CheckBox> <Slider MinWidth="200" /> </WrapPanel> I want all the CheckBoxes inside the WrapPanel to be the same width. Adding the following almost accomplishes the desired e...

Does ASP.NET MVC Has Anything Equivalent To WPF's DataTemplate Feature?

In my ASP.NET MVC project, I have a polymorphic collection that I wish to render - say, an IEnumerable<ISomething> where the individual items may be a mix of different implementations of ISomething. I'd like that list rendered, where each concrete type renders according to its own template (perhaps a strongly typed ViewUserControl). In...

How can I define and use a variable in XAML to define a color?

I have a number of elements in my XAML which define Foreground="#555" to be the color of faded text in a readonly textbox. <TextBlock Text="{Binding SingularModelClassFileTitle}" Margin="0 10 0 0"/> <TextBox Text="{Binding SingularModelClassFileName}" HorizontalAlignment="Left" IsReadOnly="True" Foreground="#...

How can WPF RIchtextbox display Unicode?

I use the WPF RichTexBox control in WPF project. The problem I get stuck in is it cannot display the unicode as the System.Windows.Forms.RichTextbox in Win Project. E.g : When I copy a paragraph of Chinese language and paste it to the WPF Richtextbox. The font is break and it cannot display. But when I use System.Windows.Forms.RichTextb...

WPF Grid - align it's children automatically

There is some way, a property like VerticalContentAlignment for aligning grid children or do I have to do it manually one by one? ...

WPF Browser Control - does not run scripts on vista but is fine on XP - why ?

I have an WPF application that hosts a <WebBrowser x:Name="WebBrowser" /> control. After loading I set the control to navigate to a web camera. this.WebBrowser.Navigate(this.NodeUrl); This web camera will run some active X controlls. On an XP machine in the rgular broser IE7 these run fine and I see video. But the hosted browser in t...

WPF Browser controll will not run activeX on Vista

I have an WPF application that hosts a control. After loading I set the control to navigate to a web camera. this.WebBrowser.Navigate(this.NodeUrl); This web camera will run some active X controlls. On an XP machine in the regular broser IE7 these run fine and I see video. But the hosted browser in the WPF does nut run the active X....

INotifyPropertyChanged WPF

What is the purpose of INotifyPropertyChanged. I know this event is fired whenever a property is changed but how can the View/UI knows that this event is fired: Here is my Customer class that implements the INotifyPropertyChanged event: public class Customer : INotifyPropertyChanged { private string _firstName; p...