mvvm

Binding a cell object's property to a DataGridCell in WPF DataGrid

Using the WPF DataGrid I have the need to change various display and related properties of a DataGridCell - such as Foreground, FontStyle, IsEnabled and so on - based on the relevant value of the cell object property. Now this is easy to do in code, for example (using an Observable Collection of ObservableDictionaries): var b = new...

Silverlight's ItemsControl Canvas.TopProperty and Canvas.LeftProperty not used

Hi, I want to create a canvas where a user can drop UI elements (representing tasks). He can then drag them to rearrange them. The elements are contained in an ObservableCollection that is the DataContext. I can set the Left and Top properties of the Canvas, but the objects position is not affected. Any ideas? Thanks, Karel UPDATE...

Prism wfh pass entity to modal for modal View

Hi guys, I'm using the MVVM pattern with Prism 2.0 framework and WPF. I've run into a problem with a modal Window and initializing a ViewModel using Events. In my module I have some code that creates an object which I then want to pass this into my ViewModel so that the View can bind to it's properties. Normally I'd use the EventAggreg...

DateTime Not showing with currentculture format in Datagrid,ListView

In WPF I am trying to Bind a Date property to Datagrid, and If I only have the date Property binded as DateTime format I can sort it in the datagrid. And Here I have to show the regional Date, If the user changes the Region and Language settings, The application should show the resepective time format. Here comes the Issue, When the Da...

databinding hidden (non visible) combo box in xaml

Hi, I have a problem binding data to a combobox that's in a secondary (not initially focused) tab. Basically, I have a silverlight form with multiple tabs, whenever I move this combobox to the first (main) tab, the data is loaded and everything works as expected, but when this combo box is in a secondary tab that doesn't have focus init...

What's the design pattern name for using domain models & view models (aka AutoMapper) with MVC

Is there a name for the software design pattern that involves MVC with domain models and view models? It's the pattern used when a tool like AutoMapper is employed. I was attempting to explain the advantages of such a design to some fellow programmers and was calling it MVVM but I'm now of the opinion that's not right and the MVVM patte...

silverlight resource incompatibility with VS designer?

I have the following defined at the top of my XAML: <controls:ChildWindow x:Class="MyProject.SilverlightUI.Views.CharacterGenerator" xmlns:my="clr-namespace:MyProject.SilverlightUI.ViewModels" > <controls:ChildWindow.Resources> <my:AlignmentsViewModel x:Key="AlignmentsVM" ></my:AlignmentsViewModel> <CollectionViewSourc...

View bound to paged collection view not updating all of the time.

I new to silverlight and trying to make a business application using the mvvm pattern and ria services. I have a view model class that contains a PagedCollectoinView and it is set to the item source of a datagrid. When I update the PagedCollectionView the datagrid is only updated the first time then after that subsequent changes to the d...

Silverlight dataform blanks out textbox when focus is given to other textbox on form.

I have a data form that I assign a new Entity class as its current item. The problem is when i tab from one textbox on the dataform to the next the first one reverts back to a blank textbox. If hit save it will save the values you typed buy you cant see them once you tab or click on the next texbox. Below is my xaml and code behind. < ...

WPF DataGrid Add, Update and Delete using MVVM

I am looking for a sample code/Article which would demonstrate WPF DataGrid in action with MVVM pattern to add, updated and delete record from database. I have a specific requirement for allowing user to insert new record using DataGrid not a new child form. If anyone can recommend good resource or provide a sample for that particular ...

Bind a Command to a Button inside a ListView with Caliburn.Micro

Hi, I'm trying to create something like a MDI tabbed Interface so I have a navigation pane (a Listbox) on the left, and a ContentPresenter on the right. I have a ShellViewModel that has a BindableCollection on it called AvailAbleScreens and I managed successfully to bind to that list with a ListViews DataTemplate: <ListView x:Name="Av...

Silverlight 4: how to switch control visibility

I am using MVVM in my Silverlight app. When control visibility is need to be managed by data, I am connecting its 'Visibility' property to object's corresponding property: XAML: <TextBlock Text="Price" Visibility="{Binding PriceVisibility, Mode=OneWay}"/> <TextBox Text="{Binding TicketPrice, Mode=TwoWay}" Visibility="{Binding PriceVisi...

Problem with binding a datagrid's selected item to treeview's selected value

I have problems with binding a treeview to a datagrid's selected item. they are in different views, but datagrid's selected item is already passed to treeview's related viewmodel. There is a SelectedGroup property in treeview's related viewmodel which is datagrid's selected item and its type is Group. I want to bind the ID field of Gr...

Combining MVVM, ORM and some hardware interfaces

Hi I'm trying to plan a architecture for a robot-controller application, which will be written in WPF. Since that MVVM is the de facto pattern for WPF, and in general is much more sexy I decided to use it as a base layout. The application will have some controllers that access hardware, beyond the domainmodel that represents the databa...

Auto cancel changes in DataForm when selection is changed

Hi %username%, I wonder how you do such thing. Assume, we have MVVM CRUD app which modifies a tree (menu structure, for example). We have a view model with the menu items and two views: the first with a TreeView and the second with a DataForm. Main problems are: DataForm can not handle hierarchical data. Depending on the menu item sel...

Changetracking and concurrency - can this fail?

I've been messing around with Expressions - and I may have gone beyond my capabilities - but here goes... I've implemented 'type-safe' INotifyPropertyChanged implementation (an example is here), but gone a bit farther and included changetracking: public abstract BaseViewModel<TEntity>:INotifyPropertyChanged { private readonly IBaseC...

MVVM / New Entity / Required Attribute / Validation before submitting

I am using the Required attribute on via the WCF RIA Services Metadata class, with the Entity Framework underneath that. I create a new entity, and let the view bind to the view model. User looks at it for awhile, clicks around, and then attempts to save it. The scenario here is that the user did not tab or click into a fields with a ...

How to expand a TreeViewItems from the inside out as with Josh Smith's WPF example

Josh Smith wrote a clear, consise tour of working with the TreeView control in WPF. The secret to the success is the binding of IsExpanded and IsSelected properties of the viewmodel to the treeviewitems. The paper is here. However after a day of attempting to map his approach to the Silverlight Toolkit TreeView I'm beginning to suspec...

Can you implement Model-View-ViewModel using Powershell and WPF using PowerBoots?

Are there any examples of this? I haven't been able to find anything on google that shows how to implement this design practice using powerboots. ...

A better way to dynamically fill in the TreeView

I want to dynamically construct a TreeView using Node which represents a typical tree node. The Node looks like class Node { public Node(string cont) { Content = cont; Children = new List<Node>(); } public string Content { get; set; } public List<Node> Children { get; set; } public bool IsLeaf { ...