zaaReloaded2/zaaReloaded2/ViewModels/ElementViewModel.cs

95 lines
2.2 KiB
C#
Executable File

/* ElementViewModel.cs
* part of zaaReloaded2
*
* Copyright 2015-2017 Daniel Kraus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using Bovender.Mvvm.ViewModels;
using zaaReloaded2.Controller.Elements;
using System.Collections.ObjectModel;
namespace zaaReloaded2.ViewModels
{
public abstract class ElementViewModel : ViewModelBase, ICloneable
{
#region Properties
/// <summary>
/// Returns the wrapped Element's label or an explicitly
/// set display string.
/// </summary>
public override string DisplayString
{
get { return Element.Label; }
}
public abstract string ToolTip { get; }
public bool IsExpanded
{
get { return _isExpanded; }
set
{
_isExpanded = value;
OnPropertyChanged("IsExpanded");
}
}
#endregion
#region Constructors
public ElementViewModel() { }
public ElementViewModel(ElementBase element)
{
Element = element;
}
#endregion
#region Protected properties
protected ElementBase Element { get; set; }
#endregion
#region Implementation of ViewModelBase
public override object RevealModelObject()
{
return Element;
}
#endregion
#region Implementation of ICloneable
public abstract object Clone();
#endregion
#region Fields
bool _isExpanded;
#endregion
}
}