RecipeSequenceSelectDialogView.xaml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <UserControl x:Class="MECF.Framework.UI.Client.CenterViews.Editors.Sequence.RecipeSequenceSelectDialogView"
  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="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
  7. xmlns:micro="clr-namespace:Caliburn.Micro"
  8. mc:Ignorable="d"
  9. Width="350"
  10. Height="500">
  11. <UserControl.Resources>
  12. <HierarchicalDataTemplate x:Key="FileTemplate" ItemsSource="{Binding Files}">
  13. <StackPanel>
  14. <TextBlock Text="{Binding Name}" />
  15. </StackPanel>
  16. </HierarchicalDataTemplate>
  17. </UserControl.Resources>
  18. <Border BorderBrush="Gray" BorderThickness="0,1,0,0" Background="{DynamicResource Tab_BG}">
  19. <Grid Margin="20,30">
  20. <Grid.RowDefinitions>
  21. <RowDefinition />
  22. <RowDefinition Height="auto"/>
  23. </Grid.RowDefinitions>
  24. <Border BorderBrush="{DynamicResource Table_BD}" BorderThickness="1" Background="{DynamicResource Table_BG_Content_Highlight}">
  25. <TreeView x:Name="PART_TREE" Margin="5" ItemsSource="{Binding Files[0].Files}" ItemTemplate="{StaticResource FileTemplate}"
  26. VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.VirtualizationMode="Recycling"
  27. Height="{Binding Path=ActualHeight,ElementName=PART_BORDER, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}">
  28. <!--Height should add for VirtualizingPanel, otherwise the App will be slow-->
  29. <TreeView.ItemContainerStyle>
  30. <Style TargetType="{x:Type TreeViewItem}" BasedOn="{StaticResource ResourceKey={x:Type TreeViewItem}}">
  31. <Setter Property="IsExpanded" Value="True"></Setter>
  32. </Style>
  33. </TreeView.ItemContainerStyle>
  34. <i:Interaction.Triggers>
  35. <i:EventTrigger EventName="SelectedItemChanged">
  36. <micro:ActionMessage MethodName="TreeSelectChanged">
  37. <micro:Parameter Value="{Binding SelectedItem, ElementName=PART_TREE}" />
  38. </micro:ActionMessage>
  39. </i:EventTrigger>
  40. <i:EventTrigger EventName="MouseDoubleClick">
  41. <micro:ActionMessage MethodName="TreeMouseDoubleClick">
  42. <micro:Parameter Value="{Binding SelectedItem, ElementName=PART_TREE}" />
  43. </micro:ActionMessage>
  44. </i:EventTrigger>
  45. </i:Interaction.Triggers>
  46. </TreeView>
  47. </Border>
  48. <StackPanel Grid.Row="1" Margin="0,10,0,0" Orientation="Horizontal" HorizontalAlignment="Center">
  49. <Button Content="OK" Width="90" Height="30">
  50. <i:Interaction.Triggers>
  51. <i:EventTrigger EventName="Click">
  52. <micro:ActionMessage MethodName="OK">
  53. </micro:ActionMessage>
  54. </i:EventTrigger>
  55. </i:Interaction.Triggers>
  56. </Button>
  57. <Button Content="Cancel" Margin="10,0,0,0" Width="90" Height="30">
  58. <i:Interaction.Triggers>
  59. <i:EventTrigger EventName="Click">
  60. <micro:ActionMessage MethodName="Cancel">
  61. </micro:ActionMessage>
  62. </i:EventTrigger>
  63. </i:Interaction.Triggers>
  64. </Button>
  65. </StackPanel>
  66. </Grid>
  67. </Border>
  68. </UserControl>