加入支持触摸的辅助方法和测试代码
This commit is contained in:
1 parent
b502b8626a
commit
f9ac5d146c
11 files changed
+618
-1
No files matched your search
@@ -46,6 +46,8 @@
|
||||
|
||||
public static readonly string NavigationWindow = nameof(NavigationWindow);
|
||||
|
||||
public static readonly string TouchDragMoveWindow = nameof(TouchDragMoveWindow);
|
||||
|
||||
public static readonly string DialogContainer = nameof(DialogContainer);
|
||||
|
||||
public static readonly string LangUpdated = nameof(LangUpdated);
|
||||
|
||||
@@ -26,6 +26,7 @@ var messageList = new List<string>
|
||||
"GlowWindow",
|
||||
"NativeCommonWindow",
|
||||
"NavigationWindow",
|
||||
"TouchDragMoveWindow",
|
||||
"DialogContainer",
|
||||
"LangUpdated"
|
||||
};
|
||||
|
||||
@@ -453,6 +453,9 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Window\NativeCommonWindow.xaml.cs">
|
||||
<DependentUpon>NativeCommonWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Window\TouchDragMoveWindow.xaml.cs">
|
||||
<DependentUpon>TouchDragMoveWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Window\NavigationWindow.xaml.cs">
|
||||
<DependentUpon>NavigationWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -1025,6 +1028,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="$(MSBuildThisFileDirectory)Window\TouchDragMoveWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="$(MSBuildThisFileDirectory)Window\NavigationWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
@@ -1441,6 +1441,17 @@ namespace HandyControlDemo.Properties.Langs
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 点击打开触摸拖动窗口 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string OpenTouchDragMoveWindow
|
||||
{
|
||||
get
|
||||
{
|
||||
return ResourceManager.GetString("OpenTouchDragMoveWindow", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 打开无非客户端区域可拖拽窗口 的本地化字符串。
|
||||
/// </summary>
|
||||
|
||||
@@ -362,7 +362,6 @@
|
||||
</data>
|
||||
<data name="About" xml:space="preserve">
|
||||
<value>关于</value>
|
||||
|
||||
</data>
|
||||
<data name="Repository" xml:space="preserve">
|
||||
<value>代码仓库</value>
|
||||
@@ -766,4 +765,7 @@
|
||||
<data name="FlexPanel" xml:space="preserve">
|
||||
<value>弹性盒子</value>
|
||||
</data>
|
||||
<data name="OpenTouchDragMoveWindow" xml:space="preserve">
|
||||
<value>点击打开触摸拖动窗口</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -880,6 +880,11 @@ namespace HandyControlDemo.Properties.Langs
|
||||
/// </summary>
|
||||
public string OpenNavigationWindow => Lang.OpenNavigationWindow;
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 点击打开触摸拖动窗口 的本地化字符串。
|
||||
/// </summary>
|
||||
public string OpenTouchDragMoveWindow => Lang.OpenTouchDragMoveWindow;
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 打开无非客户端区域可拖拽窗口 的本地化字符串。
|
||||
/// </summary>
|
||||
@@ -1969,6 +1974,11 @@ namespace HandyControlDemo.Properties.Langs
|
||||
/// </summary>
|
||||
public static string OpenNavigationWindow = nameof(OpenNavigationWindow);
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 点击打开触摸拖动窗口 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string OpenTouchDragMoveWindow = nameof(OpenTouchDragMoveWindow);
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 打开无非客户端区域可拖拽窗口 的本地化字符串。
|
||||
/// </summary>
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
<UniformGrid Margin="32" Columns="3" Rows="3" Height="200">
|
||||
<Button Command="{Binding OpenWindowCmd}" CommandParameter="{x:Static data:MessageToken.NativeCommonWindow}" Content="{ex:Lang Key={x:Static langs:LangKeys.OpenNativeCommonWindow}}"/>
|
||||
<Button Command="{Binding OpenWindowCmd}" CommandParameter="{x:Static data:MessageToken.NavigationWindow}" Content="{ex:Lang Key={x:Static langs:LangKeys.OpenNavigationWindow}}"/>
|
||||
<Button Command="{Binding OpenWindowCmd}" CommandParameter="{x:Static data:MessageToken.TouchDragMoveWindow}" Content="{ex:Lang Key={x:Static langs:LangKeys.OpenTouchDragMoveWindow}}"/>
|
||||
</UniformGrid>
|
||||
</hc:TransitioningContentControl>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,11 @@
|
||||
<Window x:Class="HandyControlDemo.Window.TouchDragMoveWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
|
||||
xmlns:ex="clr-namespace:HandyControlDemo.Tools.Extension"
|
||||
Title="{ex:Lang Key={x:Static langs:LangKeys.Title}}"
|
||||
Height="450"
|
||||
Width="800"
|
||||
Icon="/HandyControlDemo;component/Resources/Img/icon.ico">
|
||||
</Window>
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using HandyControl.Tools.Helper;
|
||||
|
||||
namespace HandyControlDemo.Window
|
||||
{
|
||||
public partial class TouchDragMoveWindow
|
||||
{
|
||||
public TouchDragMoveWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
TouchDown += MainWindow_TouchDown;
|
||||
TouchUp += MainWindow_TouchUp;
|
||||
}
|
||||
|
||||
private void MainWindow_TouchUp(object sender, TouchEventArgs e)
|
||||
{
|
||||
_currentTouchCount--;
|
||||
}
|
||||
|
||||
private void MainWindow_TouchDown(object sender, TouchEventArgs e)
|
||||
{
|
||||
CaptureTouch(e.TouchDevice);
|
||||
|
||||
if (_currentTouchCount == 0)
|
||||
{
|
||||
TouchDragMoveWindowHelper.DragMove(this);
|
||||
}
|
||||
|
||||
_currentTouchCount++;
|
||||
}
|
||||
|
||||
private uint _currentTouchCount;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user