Select to view content in your preferred language

Map Content box and transparency slider for layers

3237
4
Jump to solution
08-13-2013 11:13 PM
PietaSwanepoel2
Frequent Contributor
Does anybody know how to alter the Map Content control? (If at all possible)
We have a client that requested a transparency slider for the layers in the map contents box.
I know the transparency can be altered for each layer in the configuration side.
Also with the Silverlight API and legend but I am unsure were to add this to the application builder

Or do I need to write my own add-in that replaces the application builders map content?
0 Kudos
1 Solution

Accepted Solutions
BrianLeroux
Frequent Contributor
I am pretty sure you will need to create a custom layout to accomplish this. I did something close to what you are talking about but the transparency slider i created sits outside Map Content Control. Here is the transparency Slider I used in my custom layout based on the Accordian Layout.

Edit* - I forgot to mention that i have this collapsed by defualt and use a custom add-in to toggle visibility.

<!--Transparency Slider-->                  <Grid x:Name="TransparencyBox" HorizontalAlignment="Left" VerticalAlignment="Top" Width="190" Height="80" Margin="5" Visibility="Collapsed" Grid.Column="1">                       <Border x:Name="TransparencyContainer" Style="{StaticResource GlassyBorder}" Padding="3,3,3,3" Opacity="1">                          <!--<Border.Effect>                              <DropShadowEffect />                          </Border.Effect>-->       <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="5">                         <Grid.RowDefinitions>                             <RowDefinition Height="Auto"/>                             <RowDefinition/>                         </Grid.RowDefinitions>                         <Border BorderThickness="0" Margin="0" VerticalAlignment="Stretch"                              Background="{StaticResource AccentTextColorBrush}" Opacity="0.2"                              CornerRadius="3,3,0,0">                         </Border>                         <TextBlock TextWrapping="Wrap" Foreground="{StaticResource AccentTextColorBrush}"                                  Text="Layer Transparency"                                                                              FontSize="12" FontWeight="Bold"                                 Margin="5,2,2,2"/>                                <Button  Margin="0,0,0,0"  Opacity="1" Grid.Row="0" HorizontalAlignment="Right"  VerticalAlignment="Top" Width="23" Visibility="{Binding Visibility, ElementName=TransparencyBox}" Style="{StaticResource CloseButtonStyle}" Background="{StaticResource AccentColorBrush}" BorderBrush="{StaticResource AccentColorBrush}" Foreground="{StaticResource AccentTextColorBrush}" >        <i:Interaction.Triggers>         <i:EventTrigger EventName="Click">          <ei:ChangePropertyAction TargetObject="{Binding ElementName=TransparencyBox}" PropertyName="Visibility">           <ei:ChangePropertyAction.Value>            <Visibility>Collapsed</Visibility>          </ei:ChangePropertyAction.Value>          </ei:ChangePropertyAction>         </i:EventTrigger>        </i:Interaction.Triggers>       </Button>                                                         <Slider  Grid.Row="1" Height="23" Width="150" Name="slider1" HorizontalAlignment="Center" Minimum="0" Maximum="1" Value="{Binding Path=SelectedLayer.Opacity, Mode=TwoWay, Source={StaticResource MapApplication}}" IsDirectionReversed="False" />       </Grid>                      </Border>                         </Grid>

View solution in original post

0 Kudos
4 Replies
BrianLeroux
Frequent Contributor
I am pretty sure you will need to create a custom layout to accomplish this. I did something close to what you are talking about but the transparency slider i created sits outside Map Content Control. Here is the transparency Slider I used in my custom layout based on the Accordian Layout.

Edit* - I forgot to mention that i have this collapsed by defualt and use a custom add-in to toggle visibility.

<!--Transparency Slider-->                  <Grid x:Name="TransparencyBox" HorizontalAlignment="Left" VerticalAlignment="Top" Width="190" Height="80" Margin="5" Visibility="Collapsed" Grid.Column="1">                       <Border x:Name="TransparencyContainer" Style="{StaticResource GlassyBorder}" Padding="3,3,3,3" Opacity="1">                          <!--<Border.Effect>                              <DropShadowEffect />                          </Border.Effect>-->       <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="5">                         <Grid.RowDefinitions>                             <RowDefinition Height="Auto"/>                             <RowDefinition/>                         </Grid.RowDefinitions>                         <Border BorderThickness="0" Margin="0" VerticalAlignment="Stretch"                              Background="{StaticResource AccentTextColorBrush}" Opacity="0.2"                              CornerRadius="3,3,0,0">                         </Border>                         <TextBlock TextWrapping="Wrap" Foreground="{StaticResource AccentTextColorBrush}"                                  Text="Layer Transparency"                                                                              FontSize="12" FontWeight="Bold"                                 Margin="5,2,2,2"/>                                <Button  Margin="0,0,0,0"  Opacity="1" Grid.Row="0" HorizontalAlignment="Right"  VerticalAlignment="Top" Width="23" Visibility="{Binding Visibility, ElementName=TransparencyBox}" Style="{StaticResource CloseButtonStyle}" Background="{StaticResource AccentColorBrush}" BorderBrush="{StaticResource AccentColorBrush}" Foreground="{StaticResource AccentTextColorBrush}" >        <i:Interaction.Triggers>         <i:EventTrigger EventName="Click">          <ei:ChangePropertyAction TargetObject="{Binding ElementName=TransparencyBox}" PropertyName="Visibility">           <ei:ChangePropertyAction.Value>            <Visibility>Collapsed</Visibility>          </ei:ChangePropertyAction.Value>          </ei:ChangePropertyAction>         </i:EventTrigger>        </i:Interaction.Triggers>       </Button>                                                         <Slider  Grid.Row="1" Height="23" Width="150" Name="slider1" HorizontalAlignment="Center" Minimum="0" Maximum="1" Value="{Binding Path=SelectedLayer.Opacity, Mode=TwoWay, Source={StaticResource MapApplication}}" IsDirectionReversed="False" />       </Grid>                      </Border>                         </Grid>
0 Kudos
PietaSwanepoel2
Frequent Contributor
Brian,

thank for the reply. Have been busy with other work but will look into it again

Knew I had to alter the layout but not sure how to interact with the MapApplication.
this bit: Value="{Binding Path=SelectedLayer.Opacity, Mode=TwoWay, Source={StaticResource MapApplication}}

Pieta
0 Kudos
brettangel
Frequent Contributor
You can add the "Configure Layer" tool to the context menu used in the TOC to provide the user with the transparency slider, but it will also give the user access to Pop-Ups and Auto-Update controls.  Simple built-in solution.
0 Kudos
PietaSwanepoel2
Frequent Contributor
Brett,

I know about that feature but would like to only expose the transparency feature
0 Kudos