Select to view content in your preferred language

AreAnyTouchesOver not triggered in Symbol's Controltemplate

955
4
01-25-2011 09:42 PM
linusang
Emerging Contributor
Hi,

I have the following xaml definition.. however, the "AreAnyTouchesOver" property trigger doesn't fire... but when i change to "IsMouseOver" it works fine...

i checked in snoop... the property is highlighted but the checkbox doesn't check.....

<esri:SimpleRenderer x:Key="MySimpleRenderer">
        <esri:SimpleRenderer.Symbol>
          <esri:SimpleMarkerSymbol  OffsetX="8" OffsetY="8"  >
            <esri:SimpleMarkerSymbol.ControlTemplate>
              <ControlTemplate>
              <Rectangle x:Name="TouchArea" SnapsToDevicePixels="True" Width="20" Height="20" RenderTransformOrigin="0.5,0.5"  >               
                  <Rectangle.Style>                    
                    <Style TargetType="{x:Type Rectangle}">
                      <Setter Property="Fill" Value="Red"/>
                      <Style.Triggers>
                        <Trigger Property="AreAnyTouchesOver" Value="True">
                          <Setter Property="StrokeThickness" Value="4"/>
                          <Setter Property="Stroke" Value="Green"/>
                        </Trigger>
                      </Style.Triggers>
                    </Style>
                  </Rectangle.Style>
                </Rectangle>
                
              </ControlTemplate>
            </esri:SimpleMarkerSymbol.ControlTemplate>
          </esri:SimpleMarkerSymbol>
        </esri:SimpleRenderer.Symbol>
      </esri:SimpleRenderer>
0 Kudos
4 Replies
JenniferNery
Esri Regular Contributor
Are you using WPF4 on a touch-enabled device? If yes, you may need to set Stylus.IsPressAndHoldEnabled=�?�False�?� as described in this blog http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2010/10/16/touched-part-2-raw-tou.... I had similar issue where touch events do not get fired until it seems to detect a gesture and came across one of Mike Taulty's blog.

If you are using Silverlight, you can refer to this article http://msdn.microsoft.com/en-us/magazine/ff798276.aspx

In Silverlight, triggers have been largely banished and replaced with the VSM, partially to provide a more structured approach to dynamically changing the characteristics of a control at run time, and partially to avoid dealing with all the different combinations of possibilities when multiple triggers are defined. The VSM is considered to be such an improvement over triggers that it has become part of WPF in the Microsoft .NET Framework 4
0 Kudos
linusang
Emerging Contributor
Nope, doesn't work.

The Symbol class has the VisualStates for MouseOver... however in the touch world, there is no concept of TouchOver yet... so when can we see a TouchDown visual state?
0 Kudos
dotMorten_esri
Esri Notable Contributor
Try this trigger instead:
<DataTrigger Binding="{Binding AreAnyTouchesOver,RelativeSource={RelativeSource Self}}" Value="True">
0 Kudos
linusang
Emerging Contributor
Try this trigger instead:
<DataTrigger Binding="{Binding AreAnyTouchesOver,RelativeSource={RelativeSource Self}}" Value="True">


Nope.. doesn't work... thanks for the suggestion though
0 Kudos