add XmlnsPrefix

This commit is contained in:
NaBian committed 2019-05-21 23:04:03 +08:00
1 parent 6ec2b954ab
commit 86b634e85c
95 files changed
+1313 -1310

No files matched your search

@@ -137,11 +137,6 @@ namespace HandyControl.Controls
/// </summary>
private double _imgWidHeiScale;
/// <summary>
/// 是否已经初始化
/// </summary>
private bool _isLoaded;
/// <summary>
/// 图片是否倾斜
/// </summary>
@@ -168,8 +163,6 @@ namespace HandyControl.Controls
public ImageViewer()
{
Loaded += ImageViewer_OnLoaded;
CommandBindings.Add(new CommandBinding(ControlCommands.Save, ButtonSave_OnClick));
CommandBindings.Add(new CommandBinding(ControlCommands.Open, ButtonWindowsOpen_OnClick));
CommandBindings.Add(new CommandBinding(ControlCommands.Restore, ButtonActual_OnClick));
@@ -410,7 +403,7 @@ namespace HandyControl.Controls
if (_imageMain != null)
{
var t = new RotateTransform();
BindingOperations.SetBinding(t, RotateTransform.AngleProperty, new Binding(ImageRotateProperty.Name) {Source = this});
BindingOperations.SetBinding(t, RotateTransform.AngleProperty, new Binding(ImageRotateProperty.Name) { Source = this });
_imageMain.LayoutTransform = t;
_imageMain.MouseLeftButtonDown += ImageMain_OnMouseLeftButtonDown;
}
@@ -422,6 +415,8 @@ namespace HandyControl.Controls
_canvasSmallImg.MouseMove += CanvasSmallImg_OnMouseMove;
_canvasSmallImg.MouseLeave += CanvasSmallImg_OnMouseLeave;
}
Init();
}
private static void OnImageScaleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
@@ -469,25 +464,28 @@ namespace HandyControl.Controls
}
_imgWidHeiScale = width / height;
var scaleWindow = ActualWidth / ActualHeight;
Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
var scaleWindow = DesiredSize.Width / DesiredSize.Height;
if (_imgWidHeiScale > scaleWindow)
{
if (width > ActualWidth)
ImageScale = ActualWidth / width;
if (width > DesiredSize.Width)
ImageScale = DesiredSize.Width / width;
}
else if (height > ActualHeight)
else if (height > DesiredSize.Height)
{
ImageScale = ActualHeight / height;
ImageScale = DesiredSize.Height / height;
}
else
{
ImageScale = 1;
}
ImageMargin = new Thickness((ActualWidth - ImageWidth) / 2, (ActualHeight - ImageHeight) / 2, 0, 0);
ImageMargin = new Thickness((DesiredSize.Width - ImageWidth) / 2, (DesiredSize.Height - ImageHeight) / 2, 0, 0);
_imgActualScale = 1;
_imgActualScale = ImageScale;
_imgActualMargin = ImageMargin;
InitBorderSmall();
}
private void ButtonActual_OnClick(object sender, RoutedEventArgs e)
@@ -571,8 +569,11 @@ namespace HandyControl.Controls
{
base.OnRenderSizeChanged(sizeInfo);
if (!_isLoaded) return;
OnRenderSizeChanged();
}
private void OnRenderSizeChanged()
{
if (ImageWidth < 0.001 || ImageHeight < 0.001) return;
_canMoveX = true;
@@ -601,13 +602,6 @@ namespace HandyControl.Controls
MoveSmallImg(_imgSmallMouseDownMargin.Left, _imgSmallMouseDownMargin.Top);
}
private void ImageViewer_OnLoaded(object sender, RoutedEventArgs e)
{
if (_isLoaded) return;
Init();
_isLoaded = true;
}
private void ImageMain_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
_imgMouseDownPoint = Mouse.GetPosition(_panelMain);
@@ -773,7 +767,7 @@ namespace HandyControl.Controls
{
_imgActualRotate = rotate;
_isOblique = ((int) _imgActualRotate - 90) % 180 == 0;
_isOblique = ((int)_imgActualRotate - 90) % 180 == 0;
ShowSmallImgInternal = false;
Init();
InitBorderSmall();
@@ -159,7 +159,10 @@ namespace HandyControl.Controls
{
var ctl = (NumericUpDown) d;
var v = (double) e.NewValue;
ctl._textBox.Text = v.ToString();
if (ctl._textBox != null)
{
ctl._textBox.Text = v.ToString();
}
ctl.OnValueChanged(new FunctionEventArgs<double>(ValueChangedEvent, ctl)
{
@@ -24,6 +24,8 @@ namespace HandyControl.Controls
private readonly Dictionary<object, TransferEntry> _entryDic = new Dictionary<object, TransferEntry>();
private readonly List<TransferEntry> _entryList = new List<TransferEntry>();
private SimpleItemsControl _itemsOrigin;
private SimpleItemsControl _itemsSelected;
@@ -113,6 +115,7 @@ namespace HandyControl.Controls
SelectedItem = selected
};
_entryDic.Add(item, entry);
_entryList.Add(entry);
_itemsOrigin.Items.Add(origin);
_itemsSelected.Items.Add(selected);
}
@@ -124,12 +127,14 @@ namespace HandyControl.Controls
_itemsOrigin.Items.Remove(entry.OriginItem);
_itemsSelected.Items.Remove(entry.SelectedItem);
_entryDic.Remove(item);
_entryList.Remove(entry);
}
}
private void ClearItems()
{
_entryDic.Clear();
_entryList.Clear();
_itemsOrigin.Items.Clear();
_itemsSelected.Items.Clear();
}
@@ -224,10 +229,10 @@ namespace HandyControl.Controls
protected override void Refresh()
{
if (_entryDic.Count > 0)
if (_entryList.Count > 0)
{
_entryDic.Select(item => item.Value.OriginItem).Do(item => _itemsOrigin.Items.Add(item));
_entryDic.Select(item => item.Value.SelectedItem).Do(item => _itemsSelected.Items.Add(item));
_entryList.Select(item => item.OriginItem).Do(item => _itemsOrigin.Items.Add(item));
_entryList.Select(item => item.SelectedItem).Do(item => _itemsSelected.Items.Add(item));
}
}
@@ -1,4 +1,5 @@
#if !Core
using System.Windows.Markup;
#if !Core
using System.Reflection;
using System.Runtime.InteropServices;
@@ -12,4 +13,14 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.5.5")]
#endif
#endif
[assembly: XmlnsDefinition("https://handyorg.github.io/handycontrol", "HandyControl.Controls")]
[assembly: XmlnsDefinition("https://handyorg.github.io/handycontrol", "HandyControl.Tools")]
[assembly: XmlnsDefinition("https://handyorg.github.io/handycontrol", "HandyControl.Tools.Converter")]
[assembly: XmlnsDefinition("https://handyorg.github.io/handycontrol", "HandyControl.Interactivity")]
[assembly: XmlnsDefinition("https://handyorg.github.io/handycontrol", "HandyControl.Expression.Shapes")]
[assembly: XmlnsDefinition("https://handyorg.github.io/handycontrol", "HandyControl.Expression.Media")]
[assembly: XmlnsDefinition("https://handyorg.github.io/handycontrol", "HandyControl.Data")]
[assembly: XmlnsDefinition("https://handyorg.github.io/handycontrol", "HandyControl.Properties.Langs")]
[assembly: XmlnsPrefix("https://handyorg.github.io/handycontrol", "hc")]