ItemsSelectDialogView.xaml 5.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <UserControl x:Class="MECF.Framework.UI.Client.CenterViews.Dialogs.ItemsSelectDialogView"
  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:i="http://schemas.microsoft.com/expression/2010/interactivity"
  7. xmlns:cal="clr-namespace:Caliburn.Micro"
  8. xmlns:local="clr-namespace:MECF.Framework.UI.Client.CenterViews.Dialogs"
  9. xmlns:converters="clr-namespace:Aitex.Core.UI.Converters;assembly=MECF.Framework.UI.Core"
  10. mc:Ignorable="d"
  11. d:DesignHeight="300" d:DesignWidth="300">
  12. <UserControl.Resources>
  13. <converters:BoolToValueConverter x:Key="BoolToValueConverter"/>
  14. </UserControl.Resources>
  15. <Border BorderBrush="Black" BorderThickness="1">
  16. <DockPanel Background="{StaticResource MainArea_BG}">
  17. <StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" HorizontalAlignment="Center">
  18. <Button x:Name="btnOk" Content="Ok" Width="80" Height="40" Margin="0,0,20,0" Style="{StaticResource CommandButton}">
  19. <i:Interaction.Triggers>
  20. <i:EventTrigger EventName="Click">
  21. <cal:ActionMessage MethodName="OK"/>
  22. </i:EventTrigger>
  23. </i:Interaction.Triggers>
  24. </Button>
  25. <Button x:Name="btnClose" Content="Cancel" Style="{StaticResource CommandButton}">
  26. <i:Interaction.Triggers>
  27. <i:EventTrigger EventName="Click">
  28. <cal:ActionMessage MethodName="Cancel"/>
  29. </i:EventTrigger>
  30. </i:Interaction.Triggers>
  31. </Button>
  32. </StackPanel>
  33. <Border BorderThickness="1" BorderBrush="Black" Margin="5" MaxHeight="600">
  34. <ListBox ItemsSource="{Binding Items}">
  35. <ListBox.ItemsPanel>
  36. <ItemsPanelTemplate>
  37. <UniformGrid Columns="{Binding ColumnsCount}"/>
  38. </ItemsPanelTemplate>
  39. </ListBox.ItemsPanel>
  40. <ListBox.ItemTemplate>
  41. <DataTemplate>
  42. <Button Content="{Binding Name}" Visibility="{Binding IsChecked, Converter={StaticResource BoolToValueConverter}}">
  43. <i:Interaction.Triggers>
  44. <i:EventTrigger EventName="Click">
  45. <cal:ActionMessage MethodName="SelectItem">
  46. <cal:Parameter Value="{Binding}"/>
  47. </cal:ActionMessage>
  48. </i:EventTrigger>
  49. </i:Interaction.Triggers>
  50. <Button.Resources>
  51. <Style TargetType="Button" BasedOn="{StaticResource CommandButton}">
  52. <Setter Property="Foreground" Value="Black"/>
  53. <Setter Property="IsEnabled" Value="{Binding IsEnable}"/>
  54. <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}, Path=DataContext.ButtonWidth}"/>
  55. <Setter Property="Height" Value="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}, Path=DataContext.ButtonHeight}"/>
  56. <Setter Property="Margin" Value="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}, Path=DataContext.ButtonMargin}"/>
  57. <Style.Triggers>
  58. <DataTrigger Binding="{Binding IsChecked}" Value="True">
  59. <Setter Property="Background" Value="{StaticResource Button_BG_MouseOver}"/>
  60. </DataTrigger>
  61. </Style.Triggers>
  62. </Style>
  63. </Button.Resources>
  64. </Button>
  65. </DataTemplate>
  66. </ListBox.ItemTemplate>
  67. <i:Interaction.Triggers>
  68. <i:EventTrigger EventName="MouseDoubleClick">
  69. <cal:ActionMessage MethodName="TreeMouseDoubleClick">
  70. <cal:Parameter Value="{Binding SelectedItem, ElementName=PART_TREE}" />
  71. </cal:ActionMessage>
  72. </i:EventTrigger>
  73. </i:Interaction.Triggers>
  74. </ListBox>
  75. </Border>
  76. </DockPanel>
  77. </Border>
  78. </UserControl>