Меню добавляется в отдельный слой на карте, xaml код:
<m:Map NavigationVisibility="Visible">
<m:Map.CredentialsProvider>
<m:ApplicationIdCredentialsProvider ApplicationId="{StaticResource bmk}"/>
</m:Map.CredentialsProvider>
<m:Map.Children>
<m:MapLayer x:Name="ControlLayer"><!-- Собственно меню, вот оно -->
<Border CornerRadius="5" Width="100" HorizontalAlignment="Right" VerticalAlignment="Top" Background="Black" Opacity="0.8">
<StackPanel Orientation="Vertical" Margin="5" Height="95">
<RadioButton Content="Стандарт" GroupName="modeSelection" Foreground="White" IsChecked="True" Name="mode0" Checked="RadioButton_Checked"/>
<RadioButton Content="Метки" GroupName="modeSelection" Foreground="White" Checked="RadioButton_Checked" Name="mode1"/>
<RadioButton Content="Редактор" GroupName="modeSelection" Foreground="White" Checked="RadioButton_Checked" Name="mode2"/>
<RadioButton Content="Навигация" GroupName="modeSelection" Foreground="White" Checked="RadioButton_Checked" Name="mode3"/>
<StackPanel Orientation="Vertical" x:Name="AnotherControls" Visibility="Collapsed">
<Button Content="Color" x:Name="colorChange" Click="currentPoint_Click" />
<Button Content="Delete" x:Name="delComponent" Click="redoLineButton_Click"/>
</StackPanel>
<Button Content=">" x:Name="mapMenu"/><!-- Кнопка с помощью которой мы будем "раздвигать" меню -->
</StackPanel>
</Border>
</m:MapLayer>
</m:Map.Children>
</m:Map>
* This source code was highlighted with Source Code Highlighter.
Код на C#, который может пригодится:
//Обрабатываем расширения меню, которое расположенно в слое на карте
this.mapMenu.Click+=(sen,ev)=>{
Button currentButton = sen as Button;
//Если дополнительные пункты меню скрыты => открываем
if (this.AnotherControls.Visibility == Visibility.Collapsed)
{
(currentButton.Parent as Panel).Height += 40;
this.AnotherControls.Visibility = Visibility.Visible;
currentButton.Content = "<";
}
else//Иначе скрываем
{
this.AnotherControls.Visibility = Visibility.Collapsed;
(currentButton.Parent as Panel).Height -= 40;
currentButton.Content = ">";
}
};
* This source code was highlighted with Source Code Highlighter.
Комментариев нет:
Отправить комментарий