mvvm

Can you use data binding with the Content property of a WPF Frame?

I can use data binding to set the initial Content of a WPF Frame, but subsequent changes to the the bound property (implemented using INotifyPropertyChange) do not seem to change the content. Also, does anyone know if binding directly to the Content property in this way will cause the bound item to appear in the Frame or NavigationWindo...

Inject ViewModel with data throws Exception

Hello, this I got: A first chance exception of type 'System.NullReferenceException' occurred in PresentationFramework.dll When I use a parameter for the constructor of my LessonPlannerViewModel class. I use a datatemplateselector class to switch between weekly/daily view. public class ApplicationNavigationTemplateSelector : DataTempl...

Data-binding taking too long to update

In my application I have this code in my view model: hiddenTextContainer.PreHideVerticalOffset = VerticalOffset; hiddenTextContainer.HiddenText = Text.Remove(SelectionStart, SelectionLength); hiddenTextContainer.HasHiddenText = true; hiddenTextContainer.NonHiddenTextStart = SelectionStart; ...

WPF: Master - detail view with two datagrids and in MVVM

Hi, I'm trying to write a master - detail control that consists of a master datagrid and the detail datagrid. My scenario was following - I used the SelectedItem and bound it to a property in ModelView. The problem is - the SelectedItem in ViewModel is never used, so I can't get the information which item is selected in a master datagrid...

MVVM- Is there any way I can bind the visual of a visual brush to another window?

I have a settings window and am trying to set it up so that there is a live preview what the main window will look like with the current settings. Here is a picture of what the settings dialog looks like at the moment. The big black rectangle will be the preview. ...

MVVM- How would I go about propagating settings between my main view-model (and other view-models) and my settings dialog?

I am building a settings dialog for my application and right now all of the settings correspond with settings on the main view-model, but as I add more view's and view-models some may not. I need to know what the best practice is for loading the current settings into the settings dialog and then saving the settings to thier correspondi...

typesafe NotifyPropertyChanged using linq expressions

Form Build your own MVVM I have the following code that lets us have typesafe NotifyOfPropertyChange calls: public void NotifyOfPropertyChange<TProperty>(Expression<Func<TProperty>> property) { var lambda = (LambdaExpression)property; MemberExpression memberExpression; if (lambda.Body is UnaryExpression) { var un...

MVVM Binding Password

I am re-factoring my application to implement the MVVM design and i came across my first problem... Compiler won't let me bind to the Password property of the PasswordBox control. Anyone have any ideas / suggestions. ...

MVVM Group Radio Button

What is the best way of binding a number of RadioButtons to an enum using MVVM? The only way I can think of is binding each group box's IsChecked to a property, and in the setter of that property assign a value to an enum in the view model. Any help is appreciated. ...

Silverlight Data Binding for Collection in Stack Panel

I'm new to Silverlight, so I don't have a complete grasp of all the controls at my disposal. What I would like to do is use databinding and a view model to maintain a collection of items. Here is some mock code for what I'd like to do: Model public class MyItem { public string DisplayText { get; set; } public bool...

How can I make a grid of clickable images from a list of data in WPF?

Hello, I am a seasoned C and Java programmer, but an absolute WPF newbie. I am creating a kiosk application that will display a list of images of products that the user will click to see product details and maybe place an order. I am trying to structure my app with MVVM Foundation because I am used to the benefits of structure and test...

Should I use DTOs as my data models in MVVM?

I'm currently working on what will be my first real foray into using MVVM and have been reading various articles on how best to implement it. My current thoughts are to use my data models effectively as data transfer objects, make them serializable and have them exist on both the client and server sides. It seems like a logical step giv...

Creating a clickable image in WPF

I want to make a user control that shows an image and can invoke a command when clicked. Later I want to bind a list of these controls to a list of products. ...

mvvm - prismv2 - INotifyPropertyChanged

Since this is so long and prolapsed and really doesnt ask a coherent question: 1: what is the proper way to implement subproperties of a primary object in a viewmodel? 2: Has anyone found a way to fix the delegatecommand.RaiseCanExecuteChanged issue? or do I need to fix it myself until MS does? For the rest of the story...continue on....

CheckBox Command Behaviors for Silverlight MVVM Pattern

I am trying to detect when an item is checked, and which item is checked in a ListBox using Silverlight 4 and the Prism framework. I found this example on creating behaviors, and tried to follow it but nothing is happening in the debugger. I have three questions: Why isn't my command executing? How do I determine which item was check...

WPF Combobox loaded with list collection view fails to update selection on change (MVVM).

Hi Guys, Ok here is the deal (a bit wordy but I hope you will get the idea) I use MVVM for binding properties of a combo. The combobox is bound to a ListCollectionView with source collection of employee objects which is sorted by the emp. name . There is binding on SelectedValue of the combobox by the employee id. DisplayMember is em...

Silverlight 4 WCF RIA Services and MVVM is not as simple

[Disclaimer: I'm ASP.NET MVC Developer] Hi, I'm looking for some best practices with implementing MVVM pattern with WCF RIA in Silverlight 4. I'm not looking to use MEF of IoC for locating my ViewModels. What I would like to know is how to apply MVVM pattern with Silverlight 4 and WCF RIA. I don't want to use other stuff like Prism...

Combobox with collection view itemssource does not update selection box item on changes to the Model

Hello, Sorry for the earlier lengthy post. Here is my concise (!) description. I bind a collection view to a combobox as a itemsSource and also bind its selectedvalue with a property from my view model. I must keep IsSynchronizedWithCurrentItem="False". I change the source list ofr the view and then refresh the view. The changed (adde...

MVVM: Delete a CustomerViewModel, but how to get the Customer model inside it?

Hello, I have a list of CustomerViewModels in a ComboBox. The selected CustomerViewModel I want to delete and also the Customer wrapped inside it to remove it from the repository. But how can I access the Customer model inside the CustomerViewModel? ...

Defining a ContextMenu in a DataGridRow style

I'm trying to clean up some of my xaml in my views by moving a lot of the DataGrid styles into a ResourceDictionary. One of the things I'd like to move is the ContextMenu that is bound to some commands in the ViewModel. However, when I move the context menu to the ResourceDictionary, the commands are are never firing anymore, and I can...