Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

MVVM Dynamic Commands

, 24 Apr 2009 CPOL
Implementing dynamic WPF ICommands in Model-View-ViewModel architecture
MVVM_DynamicCommands.zip
ListBoxHyperlinkDemo
Documentation
MVVM Dynamic Commands.docx
ListBoxHyperlinkDemo.suo
ListBoxHyperlinkDemo
bin
Debug
ListBoxHyperlinkDemo.exe
ListBoxHyperlinkDemo.vshost.exe
ListBoxHyperlinkDemo.vshost.exe.manifest
Domain
Properties
Settings.settings
View
ViewModel
Commands
ValueConverters
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;
using ListBoxHyperlinkDemo.Domain;
using System.Collections.ObjectModel;

namespace ListBoxHyperlinkDemo.ViewModel
{
    public class MainWindowViewModel : ViewModelBase
    {
        #region Constructor

        public MainWindowViewModel()
        {
            // Initialize collection
            this.Alerts = new ObservableCollection<Alert>();
        }

        #endregion

        #region Command Properties

        /* Commands are not created as properties in this demo, 
         * because hyperlinks in list boxes cannot get to them.
         * Setting the ListBox.ItemsSource property binds list 
         * box items to a single collection property. */

        #endregion

        #region Bindable Properties

        /// <summary>
        /// Demo alerts.
        /// </summary>
        public ObservableCollection<Alert> Alerts { get; set; }

        #endregion
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

David Veeneman
Software Developer (Senior) Foresight Systems
United States United States
David Veeneman is a financial planner and software developer. He is the author of "The Fortune in Your Future" (McGraw-Hill 1998). His company, Foresight Systems, develops planning and financial software.

| Advertise | Privacy | Mobile
Web02 | 2.8.141015.1 | Last Updated 24 Apr 2009
Article Copyright 2009 by David Veeneman
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid