wpf

How to intercept execution of a RoutedCommand within the view? (WPF / MVVM)

In a WPF / MVVM application, I am trying to find a code-efficient way to set the main view cursor to Cursors.Wait prior to any lengthy operation and to restore it to the default cursor after completion. Since all operations are invoked using routed commands, I'd like to find a way of intercepting command execution, ideally by creating a...

How can I add WPF form into tab item of tab control

Hi, How can I add WPF form into tab item of tab control? like I have make wpf form, I need to add in tab control collection just like when we open wpf form in VS 2010 and it is open in Tab MDI form and different forms are showing in different tab. Thanks ...

getting selected checkbox items from listbox mvvm

Hi I have listbox in which I am dynamically showing the pre selected checkboxes from the database. Now I want to loop through it to get the selected items/values. I am using mvvm light wpf. kindly Suggest? Thanks ...

WPF: How to use views like ICollectionView and IEditableCollectionView

I understand the syntax but not how really to use it. It's clear in many basic scenarios but as soon as it get's a little bit advanced I start getting a headache. For example there are many different views but often not clear wich one to use. Also should you use always just one or mix and match. Do you use the view as your itemssource f...

Confusion about INotifyPropertyChanged and updating Bindings

From what I (thought to) understand is that implementing INotifyPropertyChanged within the ModelView, allows to raise the PropertyChanged event in case a property has been modified. That way the View should get to be notified that the underlying property has changed and hence the UI should fetch the new changes. Did I get the theory ri...

Watching a Motion Jpeg http stream in Windows Media Player

I have a camera that is sending a motion-jpeg stream over a network in real time, and I would like to open the stream and view the video in Windows Media Player. Firefox and VLC are able to show me the video, but Windows Media Player just says "Connecting to..." for forever. I think this is because the stream has no end - it's just playi...

What are the various uses of Attached Properties?

I've seen some really varying uses of AttachedProperties so far in my adventures in WPF, and am wondering, what are some of the various uses? I've seen fairly mundane uses, such as those found in Grid and Canvas, as well as some really cool hacks allowing binding to collections without setters. What other applications have you found fo...

WPF share DataGrid column setup (template? style?)

I'll start out by saying that I'm trying to follow MVVM as strictly as I can, so I'd like to do the following using Binding only. I have multiple DataGrids showing different ObservableCollections of the same data type. How can I define once which columns, and their Binding paths, will show on all of the DataGrids? It doesn't appear tha...

WPF Slider layer issue

Hi all, I'm using a WPF slider and have basically used it to implement a "Pull out control". Basically it's a slider control with two positions: 0 and 1 I have this control on the far left side so what you initially see is the thumb position at 0. The user can then drag it out to the 1 position to see the full view of the slider thumb...

Overwriting custom event handler of as ScrollViewer

Hey guys I am trying to overwrite a event handler of MouseWheel for a ScrollViewer. Since ScrollViewer is sealed, I cant simply create a "custom" class inheriting it. I guess the generic question would be: "How do I overwrite the default event." (Or something like that ;-)) Edit: The event which should replace the default "scroll" only...

Are XAML resource-files loaded once

Is a XAML resource file (ResourceDictionary) only loaded once into memory or does it have a negative memory and/or performance-effect if I include in all my UserControls and Windows a set of base resources contained in such resource-dictionaries? ...

With WPF Prism can you prevent two modules from trying to use the same region simultaneously?

Here is the overview of what I am trying to do. I have a region in the shell that is used for application modal dialogs. When a module wants to launch an application modal dialog it loads a custom Lightbox control into the region and fills it with the content I want to display (warning, wizards, etc). I have the region defined in the s...

WPF Datagrid sorting on a column bind to XML containing umbers

Hi, I am binding my WPF Datagrid to an XML source. I have a DataGridTextColumn column representing the Id of my object. When I sort on that column, it gives me for example: 1, 12, 13, 2, 3, 31, 4. I obviously would like to sort it as 1, 2, 3, 4, 12, 13, 31. Is there a way to specify that I want to sort the column based on the integer...

Subclassing WPF Window

I created a WPF Window than i modified its class definition to: public partial class myWindow : mySubclassedWindow compiler throws: "Partial declarations of 'myWindow' must not specify different base classes" myWindow.Xaml: x:Class="WpfGridtest.myWindow" so somewhere, there is another partial class, that inherits from "Window" b...

Programatically selecting items in a WPF ListView

How can I set the selected items in a WPF ListView programatically? Basically, I have a List<SomeEntity> and a ListView that is bound to another List<SomeEntity>. I need to mark the items that exist on the first list as selected. ...

wpf MinHeight & Height

I am just going over some of the finer points in the project that Josh Smith included with his wonderful MSDN mvvm post and noticed that his MainWindow has both the MinHeight/Width and Height/Width properties to set to same values. Wouldn't he have accomplished the same thing by just setting the minimums? Cheers, Berryl MinWidth="650" ...

DataGrid - Displaying Running Total From Top of Grid Through Current Row

Hello, How would I display a running total for a particular column of each record that is displayed in a DataGrid? I'd like to keep the computation logic in the view model. Desired Output: Value | Running Total 25 25 10 35 -2 33 Thank you, Ben Edit: Keep in mind that when a user-triggered DataGri...

ItemsControl - Bind Control's and Backing Collection's Sort Orders Together

Hello, Is there a way to bind an ItemsControl (like ListView or DataGrid) to a sorted collection such that: whenever the collection is resorted via code, the ItemsControl automatically reflects the new sort order, AND whenever the ItemsControl is sorted, it re-sorts the collection? Thank you, Ben ...

how do I pass a reference to an object via button_click in WPF/C#

I have two pages in WPF. Page A contains all of my code. Page B is meant to be like a control panel where I click buttons to operate window A. The problem I am running into is I want to make function calls from B to A but I am getting a scope error. In the below code I am getting the error specifically on the axFlash object. namespa...

Weird behavior for a property bound to the 'SelectedItem' of a WPF Combobox ...

When binding a property to the 'SelectedItem' of a WPF Combobox, I would expect to see that property setter get called every time the combobox's selection is changed. I'm not seeing that. Should the Combobox be calling the bound 'SelectedItem's property setter when the selection is changed? Addition: I actually have the binding partiall...