mvvm

WPF ComboBox SelectedIndex changes when IsEnabled is set to false

I am creating an application using the MVVM pattern and somewhere I have a view which contains a ComboBox. <Controls:SettingsComboBox x:Name="Setting" SelectedIndex="{Binding SteeringIndex, Mode=TwoWay}" IsEnabled="{Binding SteerAttached, Mode=TwoWay}"> <ComboBoxItem Content="{Binding Path=on, Source={x:Static Localization:C...

MVVM - Difference between Model and ViewModel

I've never used MVVM before, so I'm probably missing something obvious. When I create a new Panorama application, there's already a ViewModel folder containing ItemViewModel and MainViewModel. I thought "MainViewModel.cs" is the file that organizes the panorama. However, within MainViewModel, it has this line: public MainViewModel...

WPF DataGrid Grouping does not show up due to binding error

Hello, I get this error message: System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='System.Windows.Data.ListCollectionView' BindingExpression:Path=MaterialList; DataItem='MaterialBrowserListViewModel' (HashCode=24964411); target element is 'CollectionViewSource' (HashCode=365180...

How to Bind Grid with Properties in Code behind?

Hello All I have a grid in Xaml file and i want to generate its rowdefinition dynamically. to do that i create a List in which i added 3-4 rowdefinitions now i have to bind this property to the grid in xaml file. PLease suggess me how to do this. thanks Sher Singh ...

Silverlight MVVM Combobox Binding getting broken

I have a combo box defined as such <ComboBox Name="RoomDropDown" Visibility="{Binding Path=RoomDropDownVisible,Mode=OneWay,Converter={StaticResource BoolVisibilityConvertor}}" ItemsSource="{Binding Path=RoomList,Mode=OneWay}" DisplayMemberPath="display" SelectedValuePath="display" SelectedValue="{Binding Path=R...

WPF MVVM Updating UI Bound properties from BackgroundWorker

Are there any potential issues with updating UI bound properties of the ViewModel from the Backgroundworker? I am trying to update the VM while it is bound to the UI, and potentially users might be typing in.. how does the the synchronization work here (I don't think I can use Lock statements from XAML). Thanks in advance.. ...

How to exclude viewmodel properties from CA1811

Using VS 2010/.Net 4.0, Code Analysis warning CA1811 (see below) is fired on all properties in a ViewModel even through they are used via XAML binding: Warning CA1811 : Microsoft.Performance : 'BackupWindowViewModel.BackupCommand.get()' appears to have no upstream public or protected callers. public ICommand BackupCommand { get { ...

Context Menu items command binding WPF using MVVM

I know this question has been asked many times in different ways in many websites and also in StackOverFlow but all the answers I found are not helping me ot to be precise I am not able to understand them and implement in my application. So I thought of putting some code from my application so that you people can help me better. Problem...

Books on Rx and PRISM/CAL + MVVM

Are there any good books that explains Rx, MVVM, PRISM/CAL from ground up? I googled, but could not find anything that covers all these three. ...

Silverlight Web App MVVM

Hi, I am trying to create a multiple user control silverlight application with MVVM pattern. Here is sample of my first page User control <Grid x:Name="LayoutRoot" Background="GhostWhite" > <Grid.ColumnDefinitions> <ColumnDefinition Width="100" /> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <Bor...

Silverlight MVVM Combobox Binding getting broken

I have a combo box defined as such <ComboBox Name="RoomDropDown" Visibility="{Binding Path=RoomDropDownVisible,Mode=OneWay,Converter={StaticResource BoolVisibilityConvertor}}" ItemsSource="{Binding Path=RoomList,Mode=OneWay}" DisplayMemberPath="display" SelectedValuePath="display" SelectedValue="{Binding Path=R...

My DTO object is NOT being saved in the database via the data context why?

hi, i am working on a project and we are using MVVM and Wcf ria services. because of the headache posed by foreign keys whose description must be displyed in grids on UI, i had to resort to using dtos that do the work of joining queries from different tables and returning the descriptions. now the problem is tha when i want to save and...

Windows Forms (WinForms) Model View ViewModel pattern (MVVM) to DataBind or not...

First i'm not mad, because i use MVVM in WinForms-) I know about MVP (Model View Presenter) pattern and it's variants. But when i started this project i was going to learn WPF and use it, but i'm forced to rush program development, and have no time to learn WPF, so i have to write it in WinForms which i know well. So in short i have a l...

Listbox binding - delayed by one source

hey. I'm trying to maintain an MVVM model, but am tripping up somewhere when trying to bind to a listbox. The first time I run the application, I set ItemCatalog (ObservableCollection) to be a certain ObservableCollection list. The listbox is empty, but if I try again it works. However, there is a lag between the datasource and the displ...

Control events into commands and RX

Hi We have some WPF/Silverlight controls we have written using the traditional event architecture (no commands etc.), and want to convert it to MVVM compliant ones. I researched on this subject, and i take it i will have to write commands to wrap the events that i currently have in the control. I would like to design it correctly now so...

Infinite Loop when binding slider in MVVM

I have a video progress slider in XAML thus: <Slider Minimum="0" Value="{Binding Position,Mode=OneWay}" Maximum="{Binding Duration}" IsMoveToPointEnabled="True"/> And code in my viewmodel to update Position on Clock.CurrentTimeInvalidated(), which keeps the slider tracking current progress: private void Play() { Uri next = _carousel....

Looking for simple MVVM Light example

I'm trying to learn MVVM Light and am looking for a good basic example that shows a model and how to load different views. The template I see after downloading MVVM Light has no models and only one view. (http://www.galasoft.ch/mvvm/creating/) Other things I've found are more complex and a bit confusing when all I want to see are the...

Using MVVM how can I find out if a ComboBox has changed the selected value?

I have a view that has 2 combo boxes (Call them ParentTypeCombo and ChildTypeCombo). Both of these combo boxes have the same backing drop down list (call it WorkItemTypes). Using MVVM how can I know when the value was changed for these combo boxes? I have bound them to properties (Call them ParentType and ChildType). But as I recall,...

Mutually exclusive view instances in view first approach in mvvm

Hi, I have asked a question about mvvm view first approach. http://stackoverflow.com/questions/3795737/issue-with-mvvm-view-first-approach But i have seen that shared attribute is only available in version 4.0. Is there any other way to solve it ? ...

How to display a MessageBox when wrong input is given and reverting the old value of TextBox using MVVM in WPF

I have been using WPF and its built in validation controls for quiet sometime. I was going through an excellent article in codeproject whose link is given below http://www.codeproject.com/KB/WPF/wpfvalidation.aspx I am having a requirement from one of our clients which I have not been able to chieve using MVVM in WPF. The problem is as ...