mvvm

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 ...

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...

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...

Silverlight MVVM - How Can I Declaratively Bind a ComboBox in a DataGrid CellEditingTemplate using a ViewModel?

I am trying to declaratively bind a ComboBox within a DataGrid CellEditingTemplate using a ViewModel. The ComboBox is not being bound. What am I doing wrong? XAML: <UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sdk="http://schemas...

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...

Attaching a custom DependencyProperty to a StackPanel in WPF?

I'm trying to make a mouse over for a stack panel in WPF using a custom DependencyProperty (StackPanels do not handle the MouseEnter event). I've created a class for the DependencyProperty like so: Public Class MouseEnterBehavior Public Shared Property MouseEnterProperty As DependencyProperty = DependencyProperty.RegisterAttached...

Design-Time Population of ListBox with Sample Data in WPF

I have a view (usercontrol) that contains a listbox. At runtime the listbox will be populated with instances of another view (also a usercontrol). How can I populate the listbox in design-time (in Blend and Cider) with sample views that are themselves populated with sample data? ...

How to create viewmodel for a model which has collection

I have a class : public class Car { public string Name { get; set; } public int Age { get; set; } public Wheel[] Wheels {get;set;} } Collections of wheels can be changed Every properties of Car will be showing at the same control I want to see how make a ViewModel for this class. Had I good understood c...

how to get RemovedItems or AddedItems from combobox?

what could be done if i want to get the removed itema dn added items from a comboBox? ...

Different ViewModels for the same model displayed in different views

The following scenario came up in our project: We have hierarchical business objects. The root node is meant to be a project. The project contains different kind of data in it. This data is split up in "Static Data", "Result Data" and "Control Data". Project | +--- Static Data | | | +---- Dataset 1 | ...

Reload parent window from a pop-up ("child") window

Hi, How it is possible? The idea is to enter info into a form inside a pop-up/child window, and then, as you save/close it, it automatically updates the "Parent" window, from which the pop-up was originally open. Kindly Suggest, Thanks ...

How to bind StackPanel Children from a ViewModel?

New to Silverlight. I'm working on a chat application where new chat messages are added to the bottom of a list. I had a working version that used as StackPanel inside a ScrollViewer and then in some code behind used StackPanel.Children.Add(). I'm trying to convert this to a View-ViewModel approach, and I can't figure out how to bind ...

Problem with data binding (Using the MVVM pattern) to a WPF Combobox within a DataGrid's RowDetailsTemplate ...

I'm trying to bind a view model property to the 'SelectedItem' attribute of a WPF combobox. This combobox resides within a RowDetailsTemplate of a DataGrid. The binding is partially there because the view model's property getter and setter each get called once when a row is selected (And thus causes the details view to expand). However t...

Using IsDirty with ICommands

I am trying to use an IsDirty flag to control CanExecute and Navigational controls during an object edit. The problem is that in order for this to work I think I have to use onPropertyChanged for my IsDirty method so that my controls get change notification.(I want some controls to be disabled when my object IsDirty) Unfortunately I ge...

DataGrid - change edit behaviour

I have an ObservableCollection of ChildViewModels with somewhat complex behaviour. When I go to edit a row - the DataGrid goes into 'edit-mode' - this effectively disables UI-notifications outside the current cell until the row is committed - is this intended behaviour and more importantly can it be changed? Example: public class View...

How to implement a modal like behavior

Hi everybody! I 'm running currently into a situation for which i cannot find a solution: In a WPF application i 'm opening several user controls in a tabcontrol. So every tabitem has different things loaded(e.g. customer,supplier, article, warehouse,...). In the customer tabitem i want to delete the selected customer, so i want a pop...

MVVM with UI specific events on codebehind

I have a Silverlight page that has few controls and all of the behaviors are not databound. For example, RichTextBox is databound for the Text property. But the controls behaviors like Bold, Italic, Numbered, etc are driven from a button click event from toolbar above the control. These controls do change the value of the Data, but do no...

WPF: Adorning a ViewModel?

I have these ViewModels: RecordViewModel, ComponentViewModel where RecordViewModel essentially is a container for several ComponentViewModels. The display of these ViewModels is currently handled by DataTemplates that look something like this: <DataTemplate DataType="{x:Type vm:RecordViewModel}" > <ItemsControl ItemsSource={Binding...

WPF-MVVM: Custom Control/User Control/POCO for Paint-like Application?

So I am currently creating a Paint-like application for sports. You will some "shapes" for each type of sport (balls/baskets in basketball, pucks/goals in hockey etc.). Now my main problem is how I should go about designing these shapes. As I understand it there are mainly 3 options: Custom Control with ControlTemplate UserControl POC...

WPF events, commands or using both

Hello, I am constructing my app infra structure, and finding it hard to achieve a very basic behavior - I want to raise events from different user controls in the system and being able to catch those events on some other user controls that listens to them. For example i have a user control that implements a TreeView. I have another user ...