/***************************************************************************************
Extended WPF Toolkit
Copyright (C) 2007-2014 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Public
License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license
For more features, controls, and fast professional support,
pick up the Plus Edition at http://xceed.com/wpf_toolkit
Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids
*************************************************************************************/
using System.Windows.Media;
using System.Windows.Controls;
using System;
using System.Diagnostics;
using System.Windows;
using Xceed.Wpf.Toolkit;
using System.IO;
using System.Windows.Media.Imaging;
using Xceed.Wpf.Samples.SampleData;
using System.Collections.ObjectModel;
using System.Windows.Data;
namespace Xceed.Wpf.Toolkit.LiveExplorer.Samples.PileFlowPanel.Views
{
///
/// Interaction logic for PileFlowPanelView.xaml
///
public partial class PileFlowPanelView : DemoView
{
#region Initialization
public PileFlowPanelView()
{
#if !OPEN_SOURCE
this.DataContext = SampleDataProvider.SharedEmployees;
#endif
InitializeComponent();
#if !OPEN_SOURCE
_pileFlowPanel.PileFlowItemActivated += new Xceed.Wpf.Toolkit.PileFlowPanel.PileFlowItemActivatedHandler( this.PileFlowItemActivated );
_pileFlowPanel.PileFlowItemDeactivated += new Xceed.Wpf.Toolkit.PileFlowPanel.PileFlowItemDeactivatedHandler( this.PileFlowItemDeactivated );
ObservableCollection products = SampleDataProvider.GetProducts();
foreach( Product product in products )
{
this.AddImage( product );
}
#endif
}
#endregion
#if !OPEN_SOURCE
#region Event Handlers
private void PileFlowItemActivated( object sender, Xceed.Wpf.Toolkit.PileFlowPanel.PileFlowActivationEventArgs e )
{
//# Modify the text label.
_pileFlowPanel.ContentLabel.Visibility = Visibility.Visible;
_pileFlowLabel.Text = e.Item.Element.Tag as string;
//# Enable the first PileFlowItem.
if( object.Equals( ( ( PileFlowItem )sender ).Element, _employeesPileFlowCard ) )
{
_employeeListBox.IsEnabled = true;
}
}
private void PileFlowItemDeactivated( object sender, EventArgs e )
{
//# Hide the text Label.
_pileFlowPanel.ContentLabel.Visibility = Visibility.Collapsed;
_pileFlowLabel.Text = null;
//# Enable the first PileFlowItem.
if( object.Equals( ( ( PileFlowItem )sender ).Element, _employeesPileFlowCard ) )
{
_employeeListBox.IsEnabled = false;
}
}
private void OnEmployeeButtonPress( object sender, EventArgs e )
{
Xceed.Wpf.Toolkit.MessageBox.Show( "Employee data has been saved.", "Employee", MessageBoxButton.OK, MessageBoxImage.Asterisk);
}
private void OnShowReflectionsClick( object sender, RoutedEventArgs e )
{
CheckBox checkBox = ( CheckBox )sender;
foreach( UIElement item in _pileFlowPanel.Children )
{
if( item is PileFlowCard )
{
(( PileFlowCard )item).ShowReflection = ( bool )checkBox.IsChecked;
}
}
}
private void OnBeginReflectionOpacityChanged( object sender, RoutedPropertyChangedEventArgs