Click here to Skip to main content
Click here to Skip to main content

XAMLFinance – A Cross-platform WPF, Silverlight & WP7 Application

By , 21 Sep 2011
 
Prize winner in Competition "Best overall article of September 2011"
Prize winner in Competition "Best C# article of September 2011"
TwitterExample.zip
Common
SilverlightTwitterApp
SilverlightTwitterApp.suo
SilverlightTwitterApp
Properties
Resources
Twitter_logo.jpg
SilverlightTwitterApp.csproj.user
View
ViewModel
ClassDiagram.cd
WPFTwitterApp
WPFTwitterApp.suo
WPFTwitterApp
Properties
Settings.settings
Resources
View
ViewModel
XAMLFinance.zip
XAMLFinanceApp
Converter
Properties
View
ViewModel
Command
XAMLFinanceDataSource
XmlDataSource
Data
Dependencies
Visiblox
Silverlight
Visiblox.Charts.dll
WP7
Microsoft.Phone.Controls.Toolkit.dll
Visiblox.Charts.dll
WPF
Visiblox.Charts.dll
WP7
WP7Contrib.View.Controls.dll
XAMLFinanceSilverlight
XAMLFinanceAppSilverlight
Images
caret.png
close-icon.png
heatmap.png
markets.png
Properties
View
Converter
ViewModel
Command
XAMLFinanceAppSilverlight.csproj.user
XAMLFinanceAppSilverlight.suo
XAMLFinanceDataSource
Properties
XAMLFinanceDataSource.csproj.user
XmlDataSource
Data
XAMLFinanceSilverlight.suo
XAMLFinanceWP7
TreeMapWP7
Properties
Themes
TranisitioningContentControl
TreeMap
Interpolators
Layout
TreeMapWP7.csproj.user
XAMLFinanceDataSource
Properties
XAMLFinanceDataSource.csproj.user
XmlDataSource
Data
XAMLFinanceWP7.suo
XAMLFinanceWP7
addFavourite.png
ApplicationIcon.png
Background.png
Controls
Converter
heatmap.png
Properties
SplashScreenImage.jpg
Themes
View
arrow.png
Util
ViewModel
Command
wall-street-sign.jpg
XAMLFinanceWP7.csproj.user
XAMLFinanceWP7.suo
XAMLFinanceWPF
XAMLFinanceAppWPF
chart.ico
Images
close-icon.png
heatmap.png
markets.png
new-window.png
Properties
Settings.settings
View
Converter
ViewModel
Command
XAMLFinanceAppWPF.csproj.user
XAMLFinanceDataSource
Properties
XmlDataSource
Data
XAMLFinanceWPF.suo
// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.

using System.ComponentModel;
using System.Windows.Data;
using System.Windows.Markup;

namespace System.Windows.Controls.DataVisualization
{
    /// <summary>
    /// Represents a class that defines various aspects of TreeMap items.
    /// </summary>
    /// <QualityBand>Experimental</QualityBand>
    [ContentProperty("ItemTemplate")]
    public class TreeMapItemDefinition : INotifyPropertyChanged
    {
        /// <summary>
        /// A value representing the DataTemplate to instantiate in 
        /// order to create a representation of each TreeMap item.
        /// </summary>
        private DataTemplate _itemTemplate;

        /// <summary>
        /// Gets or sets a value representing the DataTemplate to instantiate in 
        /// order to create a representation of each TreeMap item.
        /// </summary>
        public DataTemplate ItemTemplate
        {
            get { return _itemTemplate; }
            set
            {
                if (value != _itemTemplate)
                {
                    _itemTemplate = value;
                    NotifyPropertyChanged("ItemTemplate");
                }
            }
        }

        /// <summary>
        /// A value representing a binding which can be used 
        /// to retrieve the value associated with each item, needed to calculate 
        /// relative areas of TreeMap items.        
        /// </summary>
        private Binding _valueBinding;

        /// <summary>
        /// Gets or sets a value representing a binding which can be used 
        /// to retrieve the value associated with each item, needed to calculate 
        /// relative areas of TreeMap items.
        /// </summary>
        public Binding ValueBinding
        {
            get { return _valueBinding; }
            set
            {
                if (value != _valueBinding)
                {
                    _valueBinding = value;
                    NotifyPropertyChanged("ValueBinding");
                }
            }
        }

        /// <summary>
        /// Gets or sets the Value Path used to set ValueBinding for retrieving 
        /// the value associated with each item, needed to calculate relative 
        /// areas of TreeMap items.
        /// </summary>
        public string ValuePath
        {
            get { return (null != ValueBinding) ? ValueBinding.Path.Path : null; }
            set
            {
                if (value != ValuePath)
                {
                    if (null == value)
                    {
                        ValueBinding = null;
                    }
                    else
                    {
                        ValueBinding = new Binding(value);
                    }

                    // PropertyChanged(); thru ValueBinding
                }
            }
        }

        /// <summary>
        /// The binding that indicates where to find the collection
        /// that represents the next level in the data hierarchy.
        /// </summary>
        private Binding _itemsSource;

        /// <summary>
        /// Gets or sets the binding that indicates where to find the collection
        /// that represents the next level in the data hierarchy.
        /// </summary>
        public Binding ItemsSource
        {
            get { return _itemsSource; }
            set
            {
                if (value != _itemsSource)
                {
                    _itemsSource = value;
                    NotifyPropertyChanged("ItemsSource");
                }
            }
        }

        /// <summary>
        /// A property representing the amount of space to leave 
        /// between a parent item and its children.
        /// </summary>
        private Thickness _childItemPadding;

        /// <summary>
        /// Gets or sets a property representing the amount of space to leave 
        /// between a parent item and its children.
        /// </summary>
        public Thickness ChildItemPadding
        {
            get { return _childItemPadding; }
            set
            {
                if (value != _childItemPadding)
                {
                    _childItemPadding = value;
                    NotifyPropertyChanged("ChildItemPadding");
                }
            }
        }

        /// <summary>
        /// Initializes a new instance of the TreeMapItemDefinition class.
        /// </summary>
        public TreeMapItemDefinition()
        {
            ChildItemPadding = new Thickness(0);
        }

        /// <summary>
        /// PropertyChanged event required by INotifyPropertyChanged.
        /// </summary>
        public event PropertyChangedEventHandler PropertyChanged;

        /// <summary>
        /// Updates the TreeMap if one of properties changes.
        /// </summary>
        /// <param name="parameterName">The parameter name.</param>
        protected void NotifyPropertyChanged(string parameterName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(parameterName));
            }
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of use 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)

About the Author

Colin Eberhardt
Architect Scott Logic
United Kingdom United Kingdom
Member
I am CTO at ShinobiControls, a team of iOS developers who are carefully crafting iOS charts, grids and controls for making your applications awesome.
 
I am a Technical Architect for Visiblox which have developed the world's fastest WPF / Silverlight and WP7 charts.
 
I am also a Technical Evangelist at Scott Logic, a provider of bespoke financial software and consultancy for the retail and investment banking, stockbroking, asset management and hedge fund communities.
 
Visit my blog - Colin Eberhardt's Adventures in .NET.
 
Follow me on Twitter - @ColinEberhardt
 
-

Permalink | Advertise | Privacy | Mobile
Web02 | 2.6.130523.1 | Last Updated 22 Sep 2011
Article Copyright 2011 by Colin Eberhardt
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid