In all tutorials about MVVM, I see code behind file is of no great use as we are trying to shift all the logic in view model. Is there any specific reason why we dont use Code Behind file itself as View Model?
I understand benefits of MVVM over typical code behind codes with events and book keeping, but I am trying to explore possibilit...
Hello folks,
I have a ViewModel with Property int DepartmentColor. Of course I can not bind the int value to a CellStyle in XAML.
Should I make a IntToStyleConverter or should I fumble around with the Style class in the ViewModel like convert the int to a SolicColorBrush and assign it to a Style etc...
Is the latter the way to go with...
In my application I have numerical (double or int) ViewModel properties that are bound to TextBoxes. The ViewModel implements IDataErrorInfo to check if the values entered fall within acceptable ranges for the 'business logic' (e.g. height can't be a negative value). I have a number of TextBoxes per page and have a button (think 'next' i...
Hi,
Me and My friend talk about how simulate a button that where pressed. The challenged were to find the event and fire it. (For WP7)
We were not a loud to use source code for finding out the event.
The big question, how would you do ?
Non of us have found the answer yeat...
...
If I want to open a new Window, without needing any immediate information, is it ok to open it this way? I know with Dialogs I should use a service, but if I don't need any information back, it is quite troublesome and messy to add a new function into the service just to open a window?
// in ShellViewModel
public ICommand AboutCommand
...
One of our legacy application is running in VB.net(3 tier) and DataTable is used as DTO. But we want to convert the application using WPF,MVVM architecture. Can i implement MVVM using Datatable as DTO or i have to create classes to represent these datatable and implement MVVM architecture. ?
...
I can add & remove tabs similar to the famous MSDN article. Basically a ObservableCollection<TabViewModels>. And I add tabs like _tabs.Add(new TabViewModel()) but the newest tab is not focused. I want to focus it. How do I do it?
1 way to do it
since i have a view source for my observable collection, I can do the below... another optio...
I don't know if I am using dependency properties right, but it seems my View never updates. I have a style trigger to change the styles of my elements. It seems the code runs, but the view is not updated. This is my 1st time using a Dependency Property & I maybe using it wrong
C#
public bool CanSave
{
get { return (bool)GetValue(C...
Hi!
I am building an module for an application that is based on MVVM, CAL and PRISM. I'm fairly new to these concepts, and trying to get my head around all the patterns and right now I'm struggling with the following problem:
I am in the need of creating multiple instances of the same View. Each one of the views need to bind to it's o...
Hi,
I am using the MVVM structure for our application. I have added the view as a data template to a grid (Developer Express DXGrid).
<DataTemplate x:Key="cardTemplate">
<ui:MediaEnquiryParticipantView x:Name="mediaEnquiryParticipantView"/>
</DataTemplate>
Now, my problem is that i want that View(MediaEnquiryParticipantView) to ...
In a static C# method, I do var brush = new LinearGradientBrush(_snazzyGradient);, and this line throws an exception. _snazzyGradient is defined as follows:
private static readonly GradientStopCollection _snazzyGradient =
new GradientStopCollection
{
new GradientStop((Color)ColorConverter.ConvertFromString("#DBF3FF"), 0...
I'm create project using Josh Smith THE MODEL-VIEW-VIEWMODEL (MVVM) DESIGN PATTER FOR WPF
But has one problem. Same workspace shown same operation. My VIEW contains tabcontrol. after creating 2 or more same workspace,when i changing selected index for tabcontrol from any workspace, other same workspace tabcontrol shown same result.
I'...
Without wanting to bug sacha too much, does anyone know what the Cinch V2 way of closing a View from a ViewModel command?
Previously I have used a RelayCommand in the ViewModel base to accept the Escape keybinding command action and wired up a RequestClose event in the View code behind to do this.
...
What are the strengths and weaknesses of various MVVM frameworks for Silverlight?
I know similar questions have been asked before, but the field is moving quickly and the answers given are rapidly out of date.
I'm specifically looking for a brief assessment of the following frameworks -
Prism
Caliburn
Cinch
Goldlight
MFedMVVM
MVVM...
My view model MyViewModel has a property MyProperty that i need to read/save from/to the application's settings. My project has Settings.settings file and the Settings type has MyProperty property. i need to bind MyViewModel.MyProperty to Settings.MyProperty so that any changes to MyViewModel.MyProperty are reflected in the Settings.MyPr...
I have a tab control
<TabControl Height="Auto" Grid.Row="1" ItemsSource="{Binding Tabs}" IsSynchronizedWithCurrentItem="True">
That is bound to Tabs in the ViewModel. I also used CollectionViewSource to focus tabs
protected ObservableCollection<TabViewModel> _tabs;
protected ICollectionView _tabsViewSource;
public ObservableCollect...
How can I from a ViewModel, find out what is the selected text? What I am doing wanting to accomplish is similar to the WMD Markdown Editor here on StackOverflow when you bold/format text. Work on the selected text and modify it
...
Hi,
I'm having problems attaching an uncheck command to a checkbox. Or more correct, I do not know how to code it. Here's my code for the check command, how should it look to get uncheck also working?
View:
<CheckBox commands:Checked.Command="{Binding CheckCommand}"
IsChecked="False"></CheckBox>
ViewModel:
Private _CheckCommand As D...
I've recently been using the MVVM light toolkit for Silverlight 4.
I really like the EventToCommand behaviour that is included, it makes life a lot easier. One thing I've been wondering about is if setting PassEventArgsToCommand="True" is bad practice as it will tie a particular RelayCommand to a particular event in the View.
E.g. If ...
Hi,
I have a menu in wpf(mvvm). Menu is of three level.
Level1
Level2_1 Level2_2
Level2_1_1, Level2_1_2, Level2_1_3
How do I make intermediate menu item clickable. I mean, I want to make "Level2_1" clickable.
Example:-
America
California Kenucky Indiana
...