init
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
// ReSharper disable CheckNamespace
|
||||
|
||||
namespace DTS.Common.Base
|
||||
{
|
||||
public abstract class BasePropertyChanged : IBasePropertyChanged
|
||||
{
|
||||
public virtual event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
public bool SetProperty<T>(ref T storage, T value, String propertyName = null)
|
||||
{
|
||||
if (Equals(storage, value)) return false;
|
||||
|
||||
storage = value;
|
||||
OnPropertyChanged(propertyName);
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual void OnPropertyChanged(string propertyName = null)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using DTS.Common.Base;
|
||||
|
||||
namespace DTS.Common.Interface
|
||||
{
|
||||
public interface ITabItemViewModel : IBaseViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the Tab Item View.
|
||||
/// </summary>
|
||||
ITabItemView View { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Tab View.
|
||||
/// </summary>
|
||||
ITabViewModel Parent { get; }
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
@@ -0,0 +1,61 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace DTS.Common.Controls
|
||||
{
|
||||
public class AutoSizedGridView : GridView
|
||||
{
|
||||
HashSet<int> _allColumns;
|
||||
HashSet<int> _autoWidthColumns;
|
||||
Dictionary<int, BindingExpression> _widthBoundColumns;
|
||||
|
||||
protected override void PrepareItem(ListViewItem item)
|
||||
{
|
||||
if (null == _allColumns || !Columns.Select(col => col.GetHashCode()).SequenceEqual(_allColumns))
|
||||
{
|
||||
_allColumns = new HashSet<int>();
|
||||
_autoWidthColumns = new HashSet<int>();
|
||||
_widthBoundColumns = new Dictionary<int, BindingExpression>();
|
||||
|
||||
foreach (var column in Columns)
|
||||
{
|
||||
_allColumns.Add(column.GetHashCode());
|
||||
if (double.IsNaN(column.Width) && //Width == "Auto"
|
||||
null == BindingOperations.GetBindingExpression(column, GridViewColumn.WidthProperty)) //Width isn't bound
|
||||
{
|
||||
_autoWidthColumns.Add(column.GetHashCode());
|
||||
}
|
||||
else if (null != BindingOperations.GetBindingExpression(column, GridViewColumn.WidthProperty))
|
||||
{
|
||||
_widthBoundColumns.Add(column.GetHashCode(), BindingOperations.GetBindingExpression(column, GridViewColumn.WidthProperty));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var column in Columns)
|
||||
{
|
||||
if (_autoWidthColumns.Contains(column.GetHashCode()))
|
||||
{
|
||||
//force remeasure
|
||||
if (double.IsNaN(column.Width))
|
||||
{
|
||||
column.Width = column.ActualWidth;
|
||||
}
|
||||
column.Width = double.NaN;
|
||||
}
|
||||
else if (_widthBoundColumns.ContainsKey(column.GetHashCode()))
|
||||
{
|
||||
//check if binding lost, re-bind
|
||||
if (null == BindingOperations.GetBindingExpression(column, GridViewColumn.WidthProperty))
|
||||
{
|
||||
BindingOperations.SetBinding(column, GridViewColumn.WidthProperty, _widthBoundColumns[column.GetHashCode()].ParentBindingBase);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
base.PrepareItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using DTS.Common.Base;
|
||||
// ReSharper disable CheckNamespace
|
||||
|
||||
namespace DTS.Common.Interface
|
||||
{
|
||||
public interface IChartOptionsViewModel : IBaseViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the Search View.
|
||||
/// </summary>
|
||||
IBaseView View { get; set; }
|
||||
IBaseViewModel Parent { get; set; }
|
||||
IChartOptionsModel Model { get; set; }
|
||||
void PublishChanges();
|
||||
void ResetZoomMethod();
|
||||
void ResetTMethod();
|
||||
void SaveToPDFMethod();
|
||||
void ShowCusor(bool value);
|
||||
void ShowMinMaxCursor(bool value);
|
||||
object ContextSearchRegion { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user