2021-09-20 18:20:01 +02:00

77 lines
4.5 KiB
XML

<!--
Copyright (C) 2014-2019 de4dot@gmail.com
This file is part of dnSpy
dnSpy is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
dnSpy is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with dnSpy. If not, see <http://www.gnu.org/licenses/>.
-->
<UserControl x:Class="dnSpy.AsmEditor.DnlibDialogs.ListVMControl"
x:ClassModifier="internal"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mvvm2="clr-namespace:dnSpy.Contracts.MVVM;assembly=dnSpy.Contracts.DnSpy"
xmlns:mvvm="clr-namespace:dnSpy.Contracts.MVVM;assembly=dnSpy.Contracts.Logic"
xmlns:p="clr-namespace:dnSpy.AsmEditor.Properties">
<UserControl.Resources>
<DataTemplate DataType="{x:Type mvvm:ViewModelBase}">
<TextBlock Text="{Binding FullName}" ToolTip="{Binding FullName}" />
</DataTemplate>
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<ListBox Grid.Row="0"
Margin="0 5 0 0"
Name="listBox"
MouseDoubleClick="listBox_MouseDoubleClick"
SelectionMode="Single"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
mvvm2:AutomationPeerMemoryLeakWorkaround.Initialize="True"
ItemsSource="{Binding Collection}"
HorizontalContentAlignment="Stretch"
IsEnabled="{Binding IsEnabled}"
SelectedIndex="{Binding Collection.SelectedIndex}" />
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0 5 0 0">
<RepeatButton Margin="0 0 5 0" Command="{Binding Collection.MoveSelectedUpCommand}" ToolTip="{x:Static p:dnSpy_AsmEditor_Resources.MoveUp_ToolTip}">
<RepeatButton.Content>
<Path Fill="{DynamicResource ListArrowBackground}" Width="16" Height="16" Data="{StaticResource ListUpArrow16x16}">
<Path.LayoutTransform>
<RotateTransform Angle="0" />
</Path.LayoutTransform>
</Path>
</RepeatButton.Content>
</RepeatButton>
<RepeatButton Margin="0 0 5 0" Command="{Binding Collection.MoveSelectedDownCommand}" ToolTip="{x:Static p:dnSpy_AsmEditor_Resources.MoveDown_ToolTip}">
<RepeatButton.Content>
<Path Fill="{DynamicResource ListArrowBackground}" Width="16" Height="16" Data="{StaticResource ListUpArrow16x16}">
<Path.LayoutTransform>
<RotateTransform Angle="180" />
</Path.LayoutTransform>
</Path>
</RepeatButton.Content>
</RepeatButton>
<Button Content="{x:Static p:dnSpy_AsmEditor_Resources.Button_Edit}" Style="{StaticResource DialogButton}" Margin="0 0 5 0" Command="{Binding EditCommand}" Visibility="{Binding NotInlineEditing, Converter={StaticResource BooleanToVisibilityConverter}}" />
<Button Content="{x:Static p:dnSpy_AsmEditor_Resources.Button_Add2}" Style="{StaticResource DialogButton}" Margin="0 0 5 0" Command="{Binding AddCommand}" Visibility="{Binding NotInlineEditing, Converter={StaticResource BooleanToVisibilityConverter}}" />
<Button Content="{x:Static p:dnSpy_AsmEditor_Resources.Button_Add}" Style="{StaticResource DialogButton}" Margin="0 0 5 0" Command="{Binding AddCommand}" Visibility="{Binding InlineEditing, Converter={StaticResource BooleanToVisibilityConverter}}" />
<Button Content="{x:Static p:dnSpy_AsmEditor_Resources.Button_Remove}" Style="{StaticResource DialogButton}" Margin="0 0 0 0" Command="{Binding Collection.RemoveSelectedCommand}" />
</StackPanel>
</Grid>
</UserControl>