I have large collection of MyFile objects which are linked in all kind of ways between each other like spaghetti.
In addition, from this collection I create smaller subcollections of some items that are equal by some criteria.
(for example all files with the extension .txt, all files that belong to certain directory etc...)
Basically I ...
I have a dependency property on my ViewModel which is the DataContext for my View. The ViewModel has no reference to the View. The property on the ViewModel is going to reference a control on the view, but I need to be able to set this property in XAML.
How is this possible? One thought I had was to develop a custom control which ha...
Hello my mvvm followers :D
I found actually 2 ways to handle mouse events on controls with the mvvm pattern.
Both ways are actually 1 way:
MVVM Light Toolkit by http://mvvmlight.codeplex.com/
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<cmd:EventToCommand
Command="{Binding SelectionC...
I'm wondering how to maintain the aspect ratio (i.e.: 16x9) of a window in WPF upon resize--if possible in a way that leverages MVVM. As I'm new to both MVVM and WPF, I'm not sure where to begin. Thanks.
...
I bet this stuff can`t be done without much code-behind :P
Can it?
...
I'm learning WPF, and am wondering if there's an idiomatic way to create a label that, when clicked, toggles a checkbox or radio button. I was somewhat surprised that the Target attribute on Label doesn't do this. I am using the MVVM pattern (with the MVVMFoundation framework.)
...
Hello,
I'm building C#/.Net 3.5 app using three layers: UI (view/view models), service, and data access/persistence.
Service Layer:
Each service layer instance is associated with a unique persistence instance. The service layer references the persistence layer via an interface.
Persistence Layer: Right now, the persistence layer in...
Hi,
I want to use MVVM approach to achieve something like below:
I have a MainWindow where i have a 3 Buttons like: a)Customers b) Orders c) Sales
By clicking on button, it should open its respective window/usercontrol xaml with customers details,orders details,sales details.
I have tried everything but culdnt able to do so.
How to ...
I am working with MVVM and WPF.
VM contains -
an Observable collection of Task (where Task is a class that has public properties TaskId, TaskTime and TaskDetails)
CurrentTaskId
I can set background color of each rows by using one of the method below
using ListView ItemContainerStyle Trigger OR
using ListView ItemContainerStyleSe...
This is a big issue for me. I want to write a WPF / MVVM application that fetches data from an online WCF service.
Problem is, that the fetching process must be every, say, 15 seconds (it's a time critical application).
There is an everchanging IEnumerable involved, every time I check the WCF service, I WILL get different values, becau...
I have a list of project dtos that contain a collection of tasks. On my ViewModel I have an ICollectionView for the projects so I can filter projects that are marked as done see below filter code.
public void FilterDoneItems()
{
if (this.MarkDone)
{
ProjectsViewSource.Filter = new Predicate<object>(F...
I have a combo box that I bind to an observable collection, which gets changed (according to company selected) and a large number of companies will have a single account (the items) therefore I want to know what the best way to make the ComboBox set the SelectedItem if there is only 1 item in the ItemsSource, otherwise leave it as null t...
How to use ICommand in key up event of a text box using MVVM architecture?
...
If you're doing MVVM and using commands, you'll often see ICommand properties on the ViewModel that are backed by private RelayCommand or DelegateCommand fields, like this example from the original MVVM article on MSDN:
RelayCommand _saveCommand;
public ICommand SaveCommand
{
get
{
if (_saveCommand == null)
{
...
I have the following validation method in my viewmodel (example is showing only one column, "ItemNumber"):
public bool IsValid
{
get
{
foreach (string property in ValidatedProperties)
if (GetValidationError(property) != null)
return false;
return true;
}
}
static readonly string[] ValidatedProperties =
{
...
Hello,
I have an MVVM application, with a view containing two custom controls, each of which has an ItemsControl that displays the same information in different ways.
Part of the data in the ViewModel is an ObservableCollection, although it is never bound to directly:
ObservableCollection<MyObservableItem> mIncludedCollection;
In th...
(I know there's some close duplicates out there, but none of them were able to help me, please hear me out)
I have the setters of my model throwing appropriate exceptions when something attempts to set an invalid value. This works wonders for validation when the user types a new value.
However, when I create a new model object, the ini...
I have a viewmodel that implements IDataError. In the viewmodel I have an ObservableCollection. The ObservableCollection populates a datagrid in my view:
// the list that populates the datagrid
public ObservableCollection<ProjectExpenseItemsDto> ListOfProjectExpenseItems
{
get { return listOfProjectExpenseItems; }
...
After fighting for a while with maintaining model-viewmodel relationships (eg. creating vm instances for each instance of model) I've got some ideas that might be quite controversial, but I'm curious of opinions.
What if VM class was made to maintain a static list of containers for model instances.
Those could(or even should) be weak r...
I have a singleton Model and ViewModel objects and would like to programmatically create and attach WPF views to them, one at a time. Views can be created dynamically, say by selecting a menu item (somewhere). Newly created view would dispose of any old view looking at a ViewModel. Then it would make itself a current view of that ViewMod...