Select to view content in your preferred language

Using silverlight Toolkit Themes in gis app

865
4
08-05-2010 03:30 AM
turgutyaleze
Emerging Contributor
Hi,

I wrote some test codes to use toolkit themes in my gis application. But in runtime map doesn't response to mouse event if i use theme before grid or border etc... when i delete theme or there is no layout control in theme it works fine. here is a sample what i mean :

<Grid x:Name="LayoutRoot" Background="White">
        <esri:Map Background="White" Name="map1">
            <esri:ArcGISTiledMapServiceLayer ID="MyBaseLayer"
                Url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer" />
            <i:Interaction.Behaviors>
                <esri:ConstrainExtentBehavior ConstrainedExtent="-120,30,-60,60" />
                <esri:ShowCoordinatesBehavior FormatString="{}{0:0.00} , {1:0.00}" />
                <esri:MaintainExtentBehavior/>
            </i:Interaction.Behaviors>
        </esri:Map>
       
        <!--<toolkit:TwilightBlueTheme Background="Transparent"> When here doesn't work-->
            <Grid>
                <Border CornerRadius="5" Width="200" Height="40" Margin="10" BorderThickness="3" BorderBrush="SteelBlue" HorizontalAlignment="Right" VerticalAlignment="Top">
                <StackPanel Orientation="Horizontal">
                    <toolkit:TwilightBlueTheme Background="Transparent"> <!--When here works-->
                    <Button Margin="5" Content="Measure" Width="75">
                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="Click">
                                <esri:MeasureAction AreaUnit="SquareMeters" DisplayTotals="True" DistanceUnit="Meters" MapUnits="Meters" MeasureMode="Polygon" TargetName="map1" FillSymbol="{StaticResource fill}" />
                                </i:EventTrigger>
                        </i:Interaction.Triggers>
                    </Button>
                    </toolkit:TwilightBlueTheme>
                </StackPanel>
            </Border>
        </Grid>
        <!--</toolkit:TwilightBlueTheme>-->
    </Grid>
0 Kudos
4 Replies
JenniferNery
Esri Regular Contributor
When using SL Toolkit Theme, does it put your map inside a ScrollViewer? This is not supported, since the scrollviewer intercepts the mouse events needed for panning.

Jennifer
0 Kudos
turgutyaleze
Emerging Contributor
No scrollViewers appears. It's interesting, code below also works.

<toolkit:TwilightBlueTheme Background="Transparent">
                    <StackPanel Orientation="Horizontal">
                    <Button Margin="5" Content="Measure" Width="75">
                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="Click">
                                <esri:MeasureAction AreaUnit="SquareMeters" DisplayTotals="True" DistanceUnit="Meters" MapUnits="Meters" MeasureMode="Polygon" TargetName="map1" FillSymbol="{StaticResource fill}" />
                                </i:EventTrigger>
                        </i:Interaction.Triggers>
                    </Button>
                        <Button Content="Spatial Query" Margin="5" Width="100" >
                            <i:Interaction.Triggers>
                                <i:EventTrigger EventName="Click">
                                    <esri:SpatialQueryAction
                                    DrawMode="Rectangle"
                                    LayerID="MyQueryResultsGraphicsLayer"
                                    Url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StatesCitiesRivers_USA/Map..."
                                    Symbol="{StaticResource GraphicsLayerFillSymbol}"
                                    TargetName="map1" />
                                </i:EventTrigger>
                            </i:Interaction.Triggers>
                        </Button>
                        <Button  Content="Clear" Margin="5" Width="75"  >
                            <i:Interaction.Triggers>
                                <i:EventTrigger EventName="Click">
                                    <esri:ClearGraphicsAction
                                    GraphicsLayerID="MyQueryResultsGraphicsLayer"
                                    TargetName="map1" />
                                </i:EventTrigger>
                            </i:Interaction.Triggers>
                        </Button>
                    </StackPanel>
                </toolkit:TwilightBlueTheme>
0 Kudos
DominiqueBroux
Esri Frequent Contributor
This happens because your theme and your grid is covering the whole map with a background.
Then the events are not going to the map.

To solve you can either reduce the size of your theme (by not using default stretch alignment) or set a null background.

Here is the code with the 2 options (one enough):
<toolkit:TwilightBlueTheme Background="{x:Null}" VerticalAlignment="Top" HorizontalAlignment="Right"> <!-- Now working-->
0 Kudos
turgutyaleze
Emerging Contributor
It is working thanks. My mistake 😄
0 Kudos