Dnspy/Extensions/dnSpy.AsmEditor/MethodBody/SwitchOperandControl.xaml
2021-09-20 18:20:01 +02:00

75 lines
3.8 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.MethodBody.SwitchOperandControl"
x:ClassModifier="internal"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mbody="clr-namespace:dnSpy.AsmEditor.MethodBody"
xmlns:mvvm="clr-namespace:dnSpy.Contracts.MVVM;assembly=dnSpy.Contracts.DnSpy"
xmlns:vc="clr-namespace:dnSpy.AsmEditor.Converters"
xmlns:p="clr-namespace:dnSpy.AsmEditor.Properties">
<UserControl.Resources>
<vc:CilObjectConverter x:Key="CilObjectConverter" />
<DataTemplate x:Key="InstructionTemplate">
<ContentPresenter Content="{Binding InstructionVM, Converter={StaticResource CilObjectConverter}}" TextBlock.FontFamily="{DynamicResource TextEditorFontFamily}" />
</DataTemplate>
<DataTemplate x:Key="EHDataTemplate">
<Border Padding="5 0 0 0">
<ContentPresenter Content="{Binding Converter={StaticResource CilObjectConverter}}" />
</Border>
</DataTemplate>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ComboBox
Grid.Column="0"
Background="{DynamicResource TEInheritedTextBackground}"
BorderBrush="{DynamicResource TEInheritedTextBackground}"
Style="{StaticResource CilEHComboBoxStyle}"
ItemTemplate="{StaticResource EHDataTemplate}"
mbody:ComboBoxAttachedProps.SelectionBoxItemTemplate="{StaticResource EHDataTemplate}"
ItemsSource="{Binding AllInstructionsVM.Items}"
SelectedIndex="{Binding AllInstructionsVM.SelectedIndex}"
VerticalContentAlignment="Center"/>
<Button Grid.Column="1" Style="{StaticResource DialogButton}" Margin="5 0 0 0" Content="{x:Static p:dnSpy_AsmEditor_Resources.Button_Add}" Command="{Binding AddInstructionCommand}" ToolTip="{x:Static p:dnSpy_AsmEditor_Resources.AddAfterSelInstr_ToolTip}" />
<Button Grid.Column="2" Style="{StaticResource DialogButton}" Margin="5 0 0 0" Content="{x:Static p:dnSpy_AsmEditor_Resources.Button_Append}" Command="{Binding AppendInstructionCommand}" />
</Grid>
<ListBox
Grid.Row="1"
Margin="0 5 0 0"
Name="listBox"
SelectionMode="Extended"
mvvm:AutomationPeerMemoryLeakWorkaround.Initialize="True"
Style="{StaticResource CilListBoxStyle}"
ItemContainerStyle="{StaticResource CilListBoxItemStyle}"
ItemTemplate="{StaticResource InstructionTemplate}"
ItemsSource="{Binding InstructionsListVM}"
SelectedIndex="{Binding SelectedIndex}"/>
</Grid>
</UserControl>