mvvm

Get a Framework element from a Storyboard

I have a reference to an instance of a Storyboard object, and want to get hold of the Framework element that it is attached to / animating. I haven't been able to come up with any way of doing this. For example, in the XAML below, can I go from a reference to the Storyboard to get hold of either the Label or the Grid <Grid> <Grid.R...

ICommands and the "CanExecuteMethod" of a DelegateCommand Why doesn't it work for us!?

We're trying to use an ICommand to set up a button in Silverlight with Prism. We'd like the button to be disabled on occasion. DelegateCommand takes 2 parameters, an "ExecuteMethod" and a "CanExecuteMethod" When we set up the ICommand we expect that if the "CanExecuteMethod" is used, then it will be called to see if the "ExecuteMeth...

Are IronPython or IronRuby well-suited for the MVVM pattern in WPF/Silverlight?

Hi all, I've been very happily using the Model-View-ViewModel (MVVM) pattern in WPF and Silverlight apps in combination with C#. Declarative XAML markup and data binding are invaluable - I just can't live without them. But, this talk by Harry Pierson on dynamic languages got me excited about learning a dynamic language, and I'd like to ...

My First WPF/MVVM App

Ok so.. I'm a bit lost. What i have is a window1.xaml just a combobox that selects different Enviroments then i have a which displays data based on environment I have a default environment when app loads up and displays the correct data. Question: I want the Dashboards data to change when a different Environment is selected. I'...

Add Composite WPF Region at runtime

Ok, here's my simple scenario. I've got collection of strings that I'm binding to a TabControl as a proof of concept. As I add strings I want a new tab with the region name as the header and a ItemsControl in the Tab container. That ItemsControl should define a new region. <TabControl x:Name="tabDemo" ItemsSource="{Binding D...

ViewModel and user interface project locations

Im writing a wpf project and using the MVVM paradigm, what i was wondering is if i should write my view model classes in their own project. Advantages i can see is that your ui project would never have to know about your business logic. (not have a reference to it) however if i want to use the ICommand interface in my view model i stil...

How do I handle opening and closing new Windows with MVVM?

With MVVM and WPF what would be a good/straightforward way to handle opening and closing new windows and dialogs? Opening and closing should be driven by the ViewModel right? But the ViewModel should not know about the view ... ...

Controllers in MVVM, How to get info from viewmodel to it's controller?

We are building an app using the MVVM pattern, we have controllers that wire up all the views and viewmodels using DI. All examples of MVVM I've seen are really simplistic and have 1 view. How do/should viewmodels talk back to the controller? The controller knows about the models and views, should the viewmodel send events back to the...

WPF IDataErrorInfo and NHibernate Validation - how to trigger a Validate?

Hi, I recently plugged the NHibernate validation into my app, I've decorated the properties of my domain objects with the NHibernate attributes as so ... [NotEmpty, Length(Min = 1, Max = 40)] public string Description { get; set; } I've also implemented IDataErrorInfo on my Domain Object ... public string this[string co...

WPF frameworks: Which one should I prefer?

There is a similar question already asked at SO: http://stackoverflow.com/questions/1409553/what-framework-for-mvvm-should-i-use But what I would like to know is whether any of these WPF frameworks are actually production ready? I really don't want to use any framework which is not well supported or are just half baked attempts. And b...

Can we bind our TextBox to an OnTextChangedEvent for MVVM?

We are using MVVM and want nothing in the View's C# file. We have a designer on staff, and don't want to teach them how to write C#. We have a Textbox that has text inside of it. It seems necessary to have the OnTextChangedEvent be inside of our VM. (We are binding the text to a string in the VM but it isn't doing everything that we ...

Hotkey commands for Silverlight in MVVM?

I'm trying to fire commands based on keystrokes in Silverlight. As I understand you cannot use AccessKey or AcceleratorKey in Silverlight. Also it looks like the might be helpful attached property InputBindings does not work either. I started looking in other places. It looked like Prism was the way to get commands working in Silverligh...

DataTemplate-driven View injection with MVVM

I have a container view that looks something like this <UserControl x:Class="Views.ContainerView"> <UserControl.Resources> <ResourceDictionary> <DataTemplate DataType="{x:Type viewmodels:AViewModel}"> <views:MyView /> </DataTemplate> <DataTemplate DataType="{x:Type viewmodels:BViewModel}"> <views:MyView /> </DataT...

WPF & MVVM: Any examples using VB.Net?

Almost every example of MVVM I found is coded in C#, are there any examples/tutorials coded in VB.Net? I'm having a hard time translating C# to VB.Net since I haven't really used C# in any meaningful way... Also, does a MVVM Template/Toolkit for VB.Net exist yet? ...

WPF (MVVM): Wiring up viewModel to view in code-behind of Window?

Hi there, I have been getting my feet wet with MVVM pattern for WPF and everything is working as it should.. But i am wiring up the viewmodel to my view datacontext from my codebehind of my window. Sure enough the point of MVVM is to get rid of code behind in windows... which it does great, so i am left with 2 simple lines to wire up...

WPF: Binding to the PasswordBOX in MVVM - working solution?

Hi there, I have come across a problem with binding to a passwordbox. It seems its a security risk but i am using the MVVM pattern so i wish to bypass this. I found some interesting code here (has anyone used this? or something similar?) http://www.wpftutorial.net/PasswordBox.html It technically looks great, but i am unsure how to ret...

WPF (MVVM): Closing a view from Viewmodel?

Hi there, Anybody come across a clever way of closing a view in a viewmodel using MVVM? Maybe there is a way of using binding to signal the view (window) to close? I would really appreciate any input anyone has. Basically i have a loginView that is bound to a loginViewModel, in the viewmodel (using binding on a command) i test to see...

many records: create business objects 1 by 1 or all at the same time?

I have a table with about 10.000 records (plus detail data in 11 tables). I want to display the data in a browsable form (1st, previous & next, last buttons). I thought about retrieving all the records, putting the data into a collection of business objects and binding the form to the collection. Thinking about it, it came to my mind t...

WPF - GridView.GridViewColumn two lines per row?

Hello is it possible to have a ListView -> ListView.View -> GridView -> GridViewColumn with "two rows" per row. eg.             COLUMN 1 | COLUMN 2 ROW 1 blah          | data             blah ROW 2 etc            | more I have tried unsuccessfully to use a Cell template but the item inside the template doesn't resize when its ...

Do I load data at the Model or at the ViewModel?

Josh Smith loaded the dummy data on the Model on this demo, while Tim Heuer loaded the dummy data on the ViewModel on this demo. Which one should I follow? :S ...