我正在创建基于Awesonium的多点触控浏览器。为此,我使用 Awesomium Web Control 和一些其他控件创建了新的用户控件。我已设置此属性:IsManipulationEnabled="True"
关于这篇文章with is here,我已经超越了这个功能:
protected override void OnManipulationDelta(ManipulationDeltaEventArgs e)
{
UIElement element = e.Source as UIElement;
MatrixTransform xform =
element.RenderTransform as MatrixTransform;
Matrix matrix = xform.Matrix;
ManipulationDelta delta = e.DeltaManipulation;
Point center = e.ManipulationOrigin;
matrix.ScaleAt(
delta.Scale.X, delta.Scale.Y, center.X, center.Y);
matrix.RotateAt(
delta.Rotation, center.X, center.Y);
matrix.Translate(
delta.Translation.X, delta.Translation.Y);
xform.Matrix = matrix;
e.Handled = true;
base.OnManipulationDelta(e);
}
但是操作对Ui元素不起作用。用户控件的XAML代码:
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:awe="http://schemas.awesomium.com/winfx" x:Class="WebControlTouch.WebBrowser"
mc:Ignorable="d"
d:DesignHeight="600" d:DesignWidth="800">
<Grid>
<awe:WebControl HorizontalAlignment="Left" Margin="0,58,0,0" VerticalAlignment="Top" Width="790" Name="_browser" AddressChanged="_browser_AddressChanged"/>
<TextBox HorizontalAlignment="Left" Name="_addressBar" Height="43" Margin="0,10,0,0" TextWrapping="Wrap" Text="Address" VerticalAlignment="Top" Width="335"/>
<Button Content="Go!" HorizontalAlignment="Left" Margin="340,10,0,0" VerticalAlignment="Top" Width="133" RenderTransformOrigin="-0.164,0.514" Height="43" Click="Button_Click"/>
</Grid>
我应该怎样做才能让操作起作用?
答案 0 :(得分:1)
我不知道你是否解决了这个问题,但在你的UserControl中你没有设置下面的代码
IsManipulationEnabled="True"
。
我不知道您在何处设置此属性,但您需要在UserControl标记中设置它