wpf

Is WPF windows rendering a slower process comparing to winforms?

I am new to wpf and from what i've seen it uses reflection a lot. My question may seem silly..Are win forms drawn faster than how wpf windows are rendered(especially when working with lots of data)? ...

MVVM Binding To Property == Null

I want to show some elements when a property is not null. What is the best way of achieving this? The following is my ViewModel: class ViewModel : ViewModelBase { public Trade Trade { get { return _trade; } set { SetField(ref _trade, value, () => Trade); } } private Trade _trade; } ViewModelBase inherits I...

C# MVVM Calculating Total

I need to calculate a trade value based on the selected price and quantity. How can The following is my ViewModel: class ViewModel : ViewModelBase { public Trade Trade { get { return _trade; } set { SetField(ref _trade, value, () => Trade); } } private Trade _trade; public decimal TradeValue { ...

Disable CTRL+P in WPF DocumentViewer

I'm working on a new presenation component for one of our applications. I am building a Custom WPF Control that just has a DocumentViewer in it and hosting that CC in a Windows Forms application with an ElementHost. I'm using Visual Studio 2008 with C#. I have customized everything through the XAML to give it the look and feel that in...

Semi-transparent custom layout panel

I have built a semi-transparent custom layout panel in WPF by setting the Opacity value of the panel to 0.5. Everything works as expected, except that the children of the panel are also semi-transparent! What do I need to change to have the children of the panel rendered without transparency? Here's the relevant code: public class Di...

WPF Window Inheritance

I have an application that will run in two modes, each with very similar displays. The application is supposed to allow easy modification of a user interface. One of the features is that it has to display the user interface. Both of these windows look the same, just one has more menus than the other. I'd like to just create a base templ...

Assign binding path at runtime in WPF DataTemplate

I am writing a WPF program in C# in which I have a ListView for which the columns will be populated at runtime. I would like to use a custom DataTemplate for the GridViewColumn objects in the ListView. In the examples I have seen where the number of columns is fixed in advance, a custom DataTemplate is often created using something like...

Is there a WPF "WrapGrid" control available or an easy way to create one?

Essentially I want a wrapPanel, but I would like items to snap to a grid rather than be pressed up to the left, so I can get a nice uniform looking grid, that automatically consumes available space. WrapPanel handles the resize part. WPF.Contrib.AutoGrid handles a nice automatic grid. Anyone got a control that combines them? My use ca...

XAML Binding to a CollectionViewSource property on a ViewModel

I have a simple ViewModel like: public class MainViewModel { ObservableCollection<Project> _projects; public MainViewModel() { // Fill _projects from DB here... ProjectList.Source = _projects; ProjectList.Filter = ...; } public CollectionViewSource ProjectList { get; set; } } I set the window's...

WPF: Best method for printing paginated datagrids

Boy did I get an education looking into this. I guess I've been spoiled by Powerbuilder, which has fantastic functionality for this out of the box. Does anyone seriously write custom documentpaginator objects to handle reporting needs for their LOB apps? I want to be able to print "for free" and not have to code like crazy just to tak...

WPF Repeater (like) control for collection source??

I have a WPF DataGrid bound to ObservableCollection. Each item in my collection has Property which is a List. In my row details pane, i would like to write out formatted textblocks for each item in this collection. The end result would be something equivalent to: <TextBlock Style="{StaticResource NBBOTextBlockStyle}" HorizontalAlignme...

Bind a WPF data grid to multiple data sources

I have created a data grid in WPF and have 2 lists. I want to bind one column to one list and rest of the columns to another list. Can anyone please tell me how to do this? Thanks ...

How to correctly bind an object to a WPF DataGrid?

I'm trying to get a WPF DataGrid to work from a user control I'm building. Things seems to work fine. But I noticed this message in the Output window in the IDE: System.Windows.Data Error: 39 : BindingExpression path error: 'Name' property not found on 'object' ''Object' (HashCode=18165668)'. BindingExpression:Path=Name; DataItem='Obje...

How can I prevent ListBox from selecting an item when I right-click it?

The tricky part is that each item has a ContextMenu that I still want to open when it is right-clicked (I just don't want it selecting it). In fact, if it makes things any easier, I don't want any automatic selection at all, so if there's some way I can disable it entirely that would be just fine. I'm thinking of just switching to an I...

Can the MVVM-Light ViewModelLocator be used in nested ViewModels?

The Visual Studio 2008 Designer doesn't seem to like UserControls that reference the MVVM-Light ViewModelLocator. I get an error message like: Could not create an instance of type 'MyUserControl'. For example, the following XAML will cause this behavior if MyUserControl uses the ViewModelLocator to establish its DataContext. <Page...

WPF: Menu Items only bind command parameters once.

Ive noticed this a couple of times when using menus with commands, they are not very dynamic, check this out. I am creating a menu from a collection of colours, I use it to colour a column in a datagrid. Anyway when i first bring up the menu (its a context menu) the command parameter binding happens and it binds to the column that the co...

Hierarchy as grid

I have hierarchy: public class Parameter { public string Name { get; set; } public Value Value { get; set; } } public abstract class Value { } public class StringValue : Value { public string Str { get; set; } } public class ComplexValue : Value { public ComplexValue() { Parameters = new List<Parameter>();...

How we put all images parallel according to margin dynamically in wpf C#(Means absolute Position of images in Canvas)

Hello! I recently learned how to put the Image in canvas from code behind, i took the width and height of all images from database at run time. the margin of all the images is the same as i want but they do not look parallel. Please help me figure out how can achieve it. Thanks in advance! Best regards, shashank private void LoadPrevi...

Is there a way to switch off wpf design surface in Visual Studio 2008?

I would like to know if there is a way to simply turn of the WPF design surface in Visual Studio 2008. I would like to have the xaml editor, but not the design surface as it slows down the IDE, when I try to open a XAML file. For my workflow having only the source files for xaml would be a better fit as I am doing all visuals in Blend. ...

Image Application in WPF and Perfomance.

Hello All, I am planning to build Image processing application using WPF. Brightness /Contrast and Histogram are main operation of this application. I have downloaded the application " Foundations: Bitmaps and Pixel Bits" from http://msdn.microsoft.com/en-us/magazine/cc534995.aspx . But when I tried to open the images which are more tha...