mvvm

C#/MVVM: Enable/Disable Buttons based on another control's property

Say i have a tab control that displays data of various types, eg EditorTabViewModel, PreviewTabViewModel both inheriting from TabViewModel. The implementation is similar to the tutorial on MSDN I want to enable buttons depending on the active tab, whether its an EditorTabViewModel or a PreviewTabViewModel. How can I achieve this? UPDAT...

What MVVM framework is Good For?

Hi. i know some Mvvm Frameworks that introduced in this thread please describe or give me link for that what are them useful for? not information about MVVM about MVVM Framework. thanks :) i want to know : What Is MVVM Framework? ...

MVVM - WPF DataGrid - AutoGeneratingColumn Event

Hello all, I'm currently taking a good look at the excellent toolkit from Laurent and I have the following question. From Blend 4, I have added an EventTrigger for the Loaded event, in my ViewModel I have the following: public RelayCommand rcAutoGeneratingColumn { get; private set; } In the constructor I have: rcAutoGeneratingColum...

Testing the View in a WPF MVMM application

Hi All I'm just getting started in the exciting world of WPF development, having been a C++ developer for many years. Testing applications with rich user interfaces has of course, always been hard. One of the problems compounding this has traditionally been that in most Windows apps, the UI, the UI logic and the App logic are all comp...

WPF DataGrid: How do I databind the properties of the SelectedItem to trigger INotifyPropertyChangedEvents?

I'm trying to do this as MVVM as possible: My Model (InterestTypeEntity) implements INotifyPropertyChanged. My ViewModel (InterestTypeAllViewModel) has an ObservableCollection that binds to a DataGrid. When changes are made to it, it sends those changes (add/remove) to the Database. the problem is, I want to also be able to update the d...

WPF MVVM Multithreading Issue

Hi all. I've seen other issues similar to mine, but i haven't seen any that i can apply to make my code work. So i'm new to MVVM, and i'm trying to get some stuff that's executing in a background thread to update on my UI. What i'm noticing is that the first time bring up the UI, and the background thread executes the first time, if th...

Loading the list of items asynchronously in a WPF listbox using Dispatcher

Hi All, I am working on creating a WPF solution which uses MVVM pattern to load searched items in a search control asynchronously. The search control which is a WPF usercontrol is created with a textbox to enter search text and search button and a hidden listbox which would be visible when it loads the searched items list in it. This us...

In WPF, how do I set a button's click event to change a grid's visibility?

I'm trying to set a button's event to change a grid's visibility using just XAML. I'm pretty sure I should be using an EventTrigger, but I couldn't get that to work so my most recent attempt is to create a DataTrigger that is bound to a field in the view-model: <Style x:Key="PersonalInfoGridStyle" TargetType="{x:Type Grid}"> <Style....

Is there anyway of consolidating similar data bindings and/or triggers in XAML?

I have a user control that hosts other controls. The way I implemented this is via data templates that define the control that should be associated with a specific view-model. These view-models have similar properties and interaction triggers. Please see XAML snippet below. The problem with this approach is that I would have to copy-pas...

Silverlight Control property as a data binding Source and View-Model property as target

I have a property on a Silverlight control that a ViewModel wants to bind to. The ViewModel need to told of changes to the property NOT the other way around Syntax like <MyControl ViewPort="{Binding VMProperty}"/> Declares ViewPort as the Target, in this instance ViewPort is the source of the data. I know I could make it TwoWay bind...

Bind to a CheckBox and execute a command in a MVVM way

I have a question similar to this one, but in a more detailed situation. I am also trying to implement the solution using the Model View Viewmodel pattern. In MainView, I have a button which calls a command (we'll call it Execute) stored in MainViewModel. I also want this command to be called when the left button of the mouse is clicked...

WPF MVVM accordion displaying problem

Hi I am writting an application using WPF MVVM and I added an accordion menu and inside the accordion I want to display a list of application. so basically my accordion menu would have categories as a header and the items inside the accordion would be my application. so we would have something like this categorie 1 -->application 1 -...

How to hook ActiveX control into events/changes into my viewmodel?

Hi, I've added WindowsMediaPlayer ActiveX to my WPF/MVVM application. Now I need the control to react to changes happening in the viewmodel (most importantly updating URL when the current selection in my collection changes). Based on Walkthrough: Hosting an ActiveX Control in WPF I have the following in my Loaded event: // Create the i...

MVVM How to Design a ViewModel for a Datagrid which columns are chosen by user

So when i have a Datagrid which i want to fill with data from my Database. I normally design a ViewModel with the Data i wanted to display. But how do i create an ViewModel for my Datagrid when i dont know before which data it will display in it ? So when i allow the user of my application to specify the Columns from the database table ...

how to bind multiple fields to same column in ListView/GridView?

hello, in a GridView column i need to display a string composed from a set of fields on my view model. how do i bind multiple fields to same column and how do i specify the format string to use for this column? thanks for any help konstantin ...

How to call Winforms-style Invoke/Delegate from MVVM?

Hi, I'm hacking away at some code which seems to have been started, at least in theory, as an MVVM project in Expression Blend, by my predecessor at this company. I've got a thread running in the background, which is running some operations on items as they happen. In order to prevent any clashes, I've also got that thread running any ...

What's the best way to send password from Silverlight to WCF RIA?

I have created Silverlight Login Page. I use PasswordBox in that page and use this solution to do MVVM in my application. BTW after I read this answer I realize that current solution is not secure. I want to know how can I improve security in my solution even though it will break MVVM. ...

WPF WCF MVVM OutOfMemoryException

I am working on this WCF-WPF app. I am frequently getting this error on an asynchronous XamDataGrid. Trying to make a WCF call and populate the Grid. I initially thought this is something to do with the large amounts of data returned from WCF and I made the call return data is much small pieces, by calling only for a category only. This ...

do exist any succesful project using mvvm? (designer viewpoint)

Preface : i know, exist several topics talking about MVVM and how it is good (or bad) but my question is a bit different :i want to know if really exist any successful project that uses partially or completely MVVM, all all as a designer viewpoint. I am starting another project using MVC (web), i have some experience with it and it wor...

Showing Dialogs in MVVM & Setting dialog options

I am just wondering is this the way to show dialogs in MVVM? public ICommand OpenFileCommand { get { if (_openFileCommand == null) { _openFileCommand = new RelayCommand(delegate { var strArr = DialogsViewModel.GetOpenFileDialog("Open a file ...", "Text files|*.txt | All Files|*.*")...