SampleMidlPos.xaml 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <UserControl
  2. x:Class="SHJX.Service.Main.Views.SampleMidlPos"
  3. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  5. xmlns:UI="clr-namespace:SHJX.Service.Library.ImitationUniform.elemetation;assembly=SHJX.Service.Library"
  6. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  7. xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
  8. xmlns:local="clr-namespace:SHJX.Service.Main.Views"
  9. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  10. xmlns:prism="http://prismlibrary.com/"
  11. xmlns:views="clr-namespace:SHJX.Service.Library.Views;assembly=SHJX.Service.Library"
  12. d:DesignHeight="180"
  13. d:DesignWidth="800"
  14. prism:ViewModelLocator.AutoWireViewModel="True"
  15. mc:Ignorable="d">
  16. <i:Interaction.Triggers>
  17. <i:EventTrigger EventName="Loaded">
  18. <i:InvokeCommandAction Command="{Binding LoadingCommand}" />
  19. </i:EventTrigger>
  20. </i:Interaction.Triggers>
  21. <UserControl.Resources>
  22. <!-- 下面这段代码不用,不能变成Uniform的样式 -->
  23. <Style x:Key="ItemContainerStyle" TargetType="{x:Type ListViewItem}">
  24. <Setter Property="Template">
  25. <Setter.Value>
  26. <ControlTemplate TargetType="{x:Type ListViewItem}">
  27. <Border
  28. x:Name="Bd"
  29. Background="{TemplateBinding Background}"
  30. BorderBrush="{TemplateBinding BorderBrush}"
  31. BorderThickness="0">
  32. <ContentPresenter />
  33. </Border>
  34. <ControlTemplate.Triggers>
  35. <Trigger Property="IsSelected" Value="true">
  36. <Setter TargetName="Bd" Property="Background" Value="Transparent" />
  37. </Trigger>
  38. </ControlTemplate.Triggers>
  39. </ControlTemplate>
  40. </Setter.Value>
  41. </Setter>
  42. </Style>
  43. <DataTemplate x:Key="itemTemplate">
  44. <views:SampleDetailControl
  45. CurrentDetailInfo="{Binding SampleDetailInfo}"
  46. CurrentName="{Binding Name}"
  47. CurrentResult="{Binding SampleResult}"
  48. CurrentTagColor="{Binding SampleTagColor}"
  49. CurrentTagNo="{Binding TagCurrentTagNo}"
  50. CurrentVolume="{Binding SampleVolume}"
  51. ResultColor="{Binding SampleResultColor}" />
  52. </DataTemplate>
  53. </UserControl.Resources>
  54. <Grid Margin="2,2,0,2">
  55. <!--<UI:ListViewImitationUniform
  56. ItemColumns="6"
  57. ItemRows="8"
  58. ItemsSource="{Binding DetailControls}" />-->
  59. <ListView
  60. x:Name="MidlSample"
  61. Background="Transparent"
  62. ItemContainerStyle="{StaticResource ItemContainerStyle}"
  63. ItemTemplate="{StaticResource ResourceKey=itemTemplate}"
  64. ItemsSource="{Binding DetailControls}">
  65. <ListView.ItemsPanel>
  66. <ItemsPanelTemplate>
  67. <UniformGrid Columns="3" Rows="7" />
  68. </ItemsPanelTemplate>
  69. </ListView.ItemsPanel>
  70. </ListView>
  71. </Grid>
  72. </UserControl>