Over Killer
Over Killer

Reputation: 513

Do WPF custom user controls have enabled multi-touch manipulations by default

I'm creating Awesonium based multitouch browser. To do that I've created new user control using Awesomium Web Control and some additional controls. I've set this property :IsManipulationEnabled="True" Regarding to this article with is here, I've overrided this function:

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);
}

But manipulation does not work on Ui element. XAML code of user control:

<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>

What I should do to make manipulations working?

Upvotes: 2

Views: 879

Answers (1)

Zuppa
Zuppa

Reputation: 11

I don't know if you solved this problem but in your UserControl you haven't set the below code
IsManipulationEnabled="True" .

I don't know where you are setting this property but you need to set it in the UserControl tag

Upvotes: 1

Related Questions