mirror of
https://github.com/SourMesen/Mesen2.git
synced 2025-04-02 10:21:44 -04:00
92 lines
No EOL
3 KiB
XML
92 lines
No EOL
3 KiB
XML
<UserControl
|
|
xmlns="https://github.com/avaloniaui"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:l="using:Mesen.Localization"
|
|
xmlns:du="using:Mesen.Debugger.Utilities"
|
|
mc:Ignorable="d" d:DesignWidth="280" d:DesignHeight="200"
|
|
x:Class="Mesen.Debugger.Controls.ActionToolbar"
|
|
x:Name="root"
|
|
>
|
|
<UserControl.Resources>
|
|
<Color x:Key="ButtonBackground">Transparent</Color>
|
|
<Color x:Key="ButtonBorderBrush">Transparent</Color>
|
|
</UserControl.Resources>
|
|
|
|
<UserControl.Styles>
|
|
<Style Selector="Button">
|
|
<Setter Property="BorderBrush" Value="Transparent" />
|
|
<Setter Property="MinWidth" Value="0" />
|
|
<Setter Property="Padding" Value="1" />
|
|
</Style>
|
|
<Style Selector="Button:pointerover">
|
|
<Setter Property="BorderBrush" Value="{DynamicResource ButtonBorderBrushPointerOver}" />
|
|
</Style>
|
|
<Style Selector="Button:disabled">
|
|
<Setter Property="Opacity" Value="0.5" />
|
|
</Style>
|
|
<Style Selector="Button:disabled > ContentPresenter">
|
|
<Setter Property="Background" Value="Transparent" />
|
|
</Style>
|
|
<Style Selector="Button Image">
|
|
<Setter Property="Margin" Value="0" />
|
|
<Setter Property="Stretch" Value="None" />
|
|
</Style>
|
|
</UserControl.Styles>
|
|
|
|
<ItemsControl DataContext="{Binding ElementName=root}" ItemsSource="{Binding Items}">
|
|
<ItemsControl.ItemsPanel>
|
|
<ItemsPanelTemplate>
|
|
<StackPanel Orientation="Horizontal" />
|
|
</ItemsPanelTemplate>
|
|
</ItemsControl.ItemsPanel>
|
|
<ItemsControl.DataTemplates>
|
|
<DataTemplate DataType="{x:Type du:ContextMenuSeparator}">
|
|
<StackPanel Width="2" Height="16" Margin="2 0" IsVisible="{Binding Visible}">
|
|
<Rectangle
|
|
Stroke="{StaticResource MesenGrayBorderColor}"
|
|
StrokeThickness="1"
|
|
Height="16"
|
|
Width="1"
|
|
/>
|
|
</StackPanel>
|
|
</DataTemplate>
|
|
|
|
<DataTemplate DataType="{x:Type du:ContextMenuAction}">
|
|
<Button
|
|
ToolTip.Tip="{Binding TooltipText}"
|
|
Command="{Binding ClickCommand}"
|
|
Click="Button_OnClick"
|
|
IsEnabled="{Binding Enabled}"
|
|
IsVisible="{Binding Visible}"
|
|
ContextRequested="Button_ContextRequested"
|
|
>
|
|
<StackPanel Orientation="Horizontal">
|
|
<ContentPresenter Content="{Binding ActionIcon}" />
|
|
<TextBlock
|
|
Padding="3 0"
|
|
Text="{Binding ActionName}"
|
|
>
|
|
<TextBlock.IsVisible>
|
|
<MultiBinding Converter="{x:Static BoolConverters.Or}">
|
|
<MultiBinding.Bindings>
|
|
<Binding Path="ActionIcon" Converter="{x:Static ObjectConverters.IsNull}" />
|
|
<Binding Path="AlwaysShowLabel" />
|
|
</MultiBinding.Bindings>
|
|
</MultiBinding>
|
|
</TextBlock.IsVisible>
|
|
</TextBlock>
|
|
</StackPanel>
|
|
<Button.ContextMenu>
|
|
<ContextMenu
|
|
IsEnabled="{Binding SubActions, Converter={x:Static ObjectConverters.IsNotNull}}"
|
|
Name="ActionMenu"
|
|
ItemsSource="{Binding SubActions}"
|
|
/>
|
|
</Button.ContextMenu>
|
|
</Button>
|
|
</DataTemplate>
|
|
</ItemsControl.DataTemplates>
|
|
</ItemsControl>
|
|
</UserControl> |