using System.Windows.Controls;
// ReSharper disable once CheckNamespace
namespace DTS.Common.Base
{
///
/// Represents the base class for views that define the appearance of data in a UserControl control.
///
///
public class BaseView : UserControl, IBaseView
{
///
/// Gets a value indicating whether the bound object data data has been changed (View is dirty).
///
public bool IsDirty
{
get
{
if (DataContext != null)
{
if (DataContext is IBaseViewModel baseViewModel)
{
return baseViewModel.IsDirty;
}
}
return false;
}
}
///
/// Gets a header info which uses by the TabControl to display the TabItem's header.
///
public string HeaderInfo
{
get
{
if (DataContext != null)
{
if (DataContext is IHeaderInfoProvider headerInfoProvider)
{
return headerInfoProvider.HeaderInfo;
}
}
return string.Empty;
}
}
}
}