MenuButton.xaml 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <UserControl x:Class="PixiEditor.Views.MenuButton"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:local="clr-namespace:PixiEditor.Views"
  7. xmlns:vm="clr-namespace:PixiEditor.ViewModels"
  8. xmlns:helpers="clr-namespace:PixiEditor.Helpers"
  9. xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
  10. mc:Ignorable="d"
  11. d:DesignHeight="330" d:DesignWidth="200" x:Name="menuButton" DataContext="{DynamicResource MenuButtonViewModel}">
  12. <UserControl.Resources>
  13. <vm:MenuButtonViewModel x:Key="MenuButtonViewModel"/>
  14. <Style TargetType="ListViewItem">
  15. <Style.Resources>
  16. <SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Transparent"/>
  17. <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent"/>
  18. </Style.Resources>
  19. </Style>
  20. </UserControl.Resources>
  21. <StackPanel Name="MainStackPanel">
  22. <Button Content="{Binding ElementName=menuButton,Path=Text}" Style="{StaticResource MenuButton}" HorizontalAlignment="Left" Command="{Binding OpenListViewCommand}"/>
  23. <ListView Visibility="{Binding ListViewVisibility}" Style="{StaticResource MenuListViewStyle}">
  24. <ListView.ItemContainerStyle>
  25. <Style TargetType="{x:Type ListViewItem}">
  26. <Setter Property="Background" Value="Transparent"/>
  27. <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
  28. <Setter Property="Template">
  29. <Setter.Value>
  30. <ControlTemplate TargetType="{x:Type ListViewItem}">
  31. <Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="Transparent" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
  32. <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
  33. </Border>
  34. <ControlTemplate.Triggers>
  35. <Trigger Property="IsMouseOver" Value="True">
  36. <Setter Property="BorderThickness" Value="1" />
  37. <Setter Property="BorderBrush" Value="Transparent" />
  38. </Trigger>
  39. </ControlTemplate.Triggers>
  40. </ControlTemplate>
  41. </Setter.Value>
  42. </Setter>
  43. </Style>
  44. </ListView.ItemContainerStyle>
  45. <ContentPresenter Content="{Binding Item, ElementName=menuButton}"/>
  46. </ListView>
  47. </StackPanel>
  48. </UserControl>