mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-12 20:26:35 +08:00
页面视图新增缩略图模式
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace AIStudio.Wpf.DiagramDesigner.Additionals.Converters
|
||||
{
|
||||
public class CardClipConverter : IMultiValueConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// 1 - Content presenter render size,
|
||||
/// 2 - Clipping border padding (main control padding)
|
||||
/// </summary>
|
||||
/// <param name="values"></param>
|
||||
/// <param name="targetType"></param>
|
||||
/// <param name="parameter"></param>
|
||||
/// <param name="culture"></param>
|
||||
/// <returns></returns>
|
||||
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (values.Length != 2 || !(values[0] is Size) || !(values[1] is Thickness))
|
||||
return Binding.DoNothing;
|
||||
|
||||
var size = (Size)values[0];
|
||||
var farPoint = new Point(
|
||||
Math.Max(0, size.Width),
|
||||
Math.Max(0, size.Height));
|
||||
var padding = (Thickness)values[1];
|
||||
farPoint.Offset(padding.Left + padding.Right, padding.Top + padding.Bottom);
|
||||
|
||||
return new Rect(
|
||||
new Point(),
|
||||
new Point(farPoint.X, farPoint.Y));
|
||||
}
|
||||
|
||||
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace AIStudio.Wpf.DiagramDesigner.Additionals.Converters
|
||||
{
|
||||
public class Object2VisibilityConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return value == null ? Visibility.Collapsed : Visibility.Visible;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user