Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
ghost1372 committed Jun 15, 2021
2 parents 90cab3a + 6ce9130 commit f2070ff
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 38 deletions.
3 changes: 2 additions & 1 deletion README-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ HandyControl 项目已加入 [dotNET China](https://gitee.com/dotnetchina) 组

| | 西江月群 | 定风波群 |
|-|:-:|:-:|
| 群号码 | [![qq-group](https://img.shields.io/badge/qq-714704041-red.svg)](//shang.qq.com/wpa/qunwpa?idkey=a571e5553c9d41e49c4f22f3a8b2865451497a795ff281fedf3285def247efc1) | [![qq-group](https://img.shields.io/badge/qq-858784803-red.svg)](//shang.qq.com/wpa/qunwpa?idkey=5c18622a0f6ee07a6f33afa8cdb85b1f72ea50e878271dfcec919c76b55afee7) | 微信群 |
| 群号码 | [![qq-group](https://img.shields.io/badge/qq-714704041-red.svg)](//shang.qq.com/wpa/qunwpa?idkey=a571e5553c9d41e49c4f22f3a8b2865451497a795ff281fedf3285def247efc1) | [![qq-group](https://img.shields.io/badge/qq-858784803-red.svg)](//shang.qq.com/wpa/qunwpa?idkey=5c18622a0f6ee07a6f33afa8cdb85b1f72ea50e878271dfcec919c76b55afee7) |
| 二维码 | ![qq-group](https://gitee.com/handyorg/HandyOrgResource/raw/master/HandyControl/Resources/qq_group_1.png) | ![qq-group](https://gitee.com/handyorg/HandyOrgResource/raw/master/HandyControl/Resources/qq_group_2.png) |

* 为我们购买防脱洗发水 (支付宝扫码)
Expand Down Expand Up @@ -87,6 +87,7 @@ HandyControl 项目已加入 [dotNET China](https://gitee.com/dotnetchina) 组
<a href="https://github.com/cuiliang" target="_blank"><img style="border-radius:50%!important" width="64px" alt="cuiliang" src="https://avatars2.githubusercontent.com/u/1972649?s=64&v=4"></a>
<a href="https://github.com/lwqwag" target="_blank"><img style="border-radius:50%!important" width="64px" alt="lwqwag" src="https://avatars3.githubusercontent.com/u/29883542?s=64&v=4"></a>
<a href="https://github.com/Epacik" target="_blank"><img style="border-radius:50%!important" width="64px" alt="Epacik" src="https://avatars.githubusercontent.com/u/23077337?s=64&v=4"></a>
<a href="https://github.com/ChoKaPeek" target="_blank"><img style="border-radius:50%!important" width="64px" alt="ChoKaPeek" src="https://avatars.githubusercontent.com/u/16904907?s=64&v=4"></a>

## 赞助者

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ This project is based on [HandyControl](https://github.com/handyOrg/HandyControl
<a href="https://github.com/cuiliang" target="_blank"><img style="border-radius:50%!important" width="64px" alt="cuiliang" src="https://avatars2.githubusercontent.com/u/1972649?s=64&v=4"></a>
<a href="https://github.com/lwqwag" target="_blank"><img style="border-radius:50%!important" width="64px" alt="lwqwag" src="https://avatars3.githubusercontent.com/u/29883542?s=64&v=4"></a>
<a href="https://github.com/Epacik" target="_blank"><img style="border-radius:50%!important" width="64px" alt="Epacik" src="https://avatars.githubusercontent.com/u/23077337?s=64&v=4"></a>
<a href="https://github.com/ChoKaPeek" target="_blank"><img style="border-radius:50%!important" width="64px" alt="ChoKaPeek" src="https://avatars.githubusercontent.com/u/16904907?s=64&v=4"></a>

## Backers

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace HandyControlDemo.Properties.Langs
{
public class LangProvider : INotifyPropertyChanged
{
internal static LangProvider Instance => ResourceHelper.GetResource<LangProvider>("DemoLangs");
internal static LangProvider Instance { get; } = ResourceHelper.GetResource<LangProvider>("DemoLangs");

private static string CultureInfoStr;

Expand Down Expand Up @@ -81,4 +81,4 @@ namespace HandyControlDemo.Properties.Langs

<#}#>
}
}
}
45 changes: 20 additions & 25 deletions src/Shared/HandyControl_Shared/Controls/Attach/DataGridAttach.cs
Original file line number Diff line number Diff line change
Expand Up @@ -264,44 +264,39 @@ private static void OnShowRowNumberChanged(DependencyObject target, DependencyPr
if (show)
{
dataGrid.LoadingRow += DataGrid_LoadingRow;
dataGrid.ItemContainerGenerator.ItemsChanged += ItemContainerGenerator_ItemsChanged;
dataGrid.ItemContainerGenerator.ItemsChanged += ItemContainerGeneratorItemsChanged;
}
else
{
dataGrid.LoadingRow -= DataGrid_LoadingRow;
dataGrid.ItemContainerGenerator.ItemsChanged -= ItemContainerGenerator_ItemsChanged;
dataGrid.ItemContainerGenerator.ItemsChanged -= ItemContainerGeneratorItemsChanged;
}

UpdateItems(dataGrid.ItemContainerGenerator, dataGrid.Items.Count, show);
}

private static void ItemContainerGenerator_ItemsChanged(object sender, ItemsChangedEventArgs e)
{
if (sender is not ItemContainerGenerator generator) return;
UpdateItems(generator, e.ItemCount);
}

private static void UpdateItems(ItemContainerGenerator generator, int itemsCount, bool show = true)
{
if (show)
void ItemContainerGeneratorItemsChanged(object sender, ItemsChangedEventArgs e)
{
for (var i = 0; i < itemsCount; i++)
var generator = dataGrid.ItemContainerGenerator;
var itemsCount = dataGrid.Items.Count;

if (show)
{
var row = (DataGridRow) generator.ContainerFromIndex(i);
if (row != null)
for (var i = 0; i < itemsCount; i++)
{
row.Header = (i + 1).ToString();
var row = (DataGridRow) generator.ContainerFromIndex(i);
if (row != null)
{
row.Header = (i + 1).ToString();
}
}
}
}
else
{
for (var i = 0; i < itemsCount; i++)
else
{
var row = (DataGridRow) generator.ContainerFromIndex(i);
if (row != null)
for (var i = 0; i < itemsCount; i++)
{
row.Header = null;
var row = (DataGridRow) generator.ContainerFromIndex(i);
if (row != null)
{
row.Header = null;
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Windows;
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using HandyControl.Data;
Expand Down Expand Up @@ -46,7 +47,9 @@ private static void UpdateTooltip(TextBlock textBlock)
textBlock.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
var width = textBlock.DesiredSize.Width - textBlock.Margin.Left - textBlock.Margin.Right;

if (textBlock.RenderSize.Width > width || textBlock.ActualWidth < width || CalcTextWidth(textBlock) > width)
// the code Math.Abs(CalcTextWidth(textBlock) - width) > 1 is not elegant end even bugly,
// while it does solve the problem of Tooltip failure in some cases
if (textBlock.RenderSize.Width > width || textBlock.ActualWidth < width || Math.Abs(CalcTextWidth(textBlock) - width) > 1)
{
ToolTipService.SetToolTip(textBlock, textBlock.Text);
}
Expand Down
20 changes: 13 additions & 7 deletions src/Shared/HandyControl_Shared/Controls/Image/ImageViewer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ public class ImageViewer : Control

private DispatcherTimer _dispatcher;

private bool _isLoaded;

#endregion Data

#region ctor
Expand All @@ -174,7 +176,11 @@ public ImageViewer()
CommandBindings.Add(new CommandBinding(ControlCommands.RotateLeft, ButtonRotateLeft_OnClick));
CommandBindings.Add(new CommandBinding(ControlCommands.RotateRight, ButtonRotateRight_OnClick));

Loaded += (s, e) => Init();
Loaded += (s, e) =>
{
_isLoaded = true;
Init();
};
}

/// <summary>
Expand Down Expand Up @@ -445,7 +451,7 @@ private static void OnImageScaleChanged(DependencyObject d, DependencyPropertyCh
/// </summary>
private void Init()
{
if (ImageSource == null || !IsLoaded) return;
if (ImageSource == null || !_isLoaded) return;

if (ImageSource.IsDownloading)
{
Expand All @@ -464,13 +470,13 @@ private void Init()

if (!_isOblique)
{
width = ImageSource.Width;
height = ImageSource.Height;
width = ImageSource.PixelWidth;
height = ImageSource.PixelHeight;
}
else
{
width = ImageSource.Height;
height = ImageSource.Width;
width = ImageSource.PixelHeight;
height = ImageSource.PixelWidth;
}

ImageWidth = width;
Expand Down Expand Up @@ -514,7 +520,7 @@ private void Dispatcher_Tick(object sender, EventArgs e)
{
if (_dispatcher == null) return;

if (ImageSource == null || !IsLoaded)
if (ImageSource == null || !_isLoaded)
{
_dispatcher.Stop();
_dispatcher.Tick -= Dispatcher_Tick;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace HandyControl.Properties.Langs
{
public class LangProvider : INotifyPropertyChanged
{
internal static LangProvider Instance => ResourceHelper.GetResource<LangProvider>("Langs");
internal static LangProvider Instance { get; } = ResourceHelper.GetResource<LangProvider>("Langs");

private static string CultureInfoStr;

Expand Down

0 comments on commit f2070ff

Please sign in to comment.