AnnotationReplyListControl.xaml 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <UserControl x:Class="ComPDFKit.Controls.PDFControlUI.AnnotationReplyListControl"
  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:common="clr-namespace:ComPDFKit.Controls.Common"
  7. xmlns:local="clr-namespace:ComPDFKit.Controls.PDFControlUI"
  8. mc:Ignorable="d"
  9. Loaded= "UserControl_Loaded"
  10. d:DesignHeight="450" d:DesignWidth="800">
  11. <UserControl.Resources>
  12. <ResourceDictionary>
  13. <ResourceDictionary.MergedDictionaries>
  14. <ResourceDictionary Source="../../../Asset/Styles/MenuItemStyle.xaml"></ResourceDictionary>
  15. </ResourceDictionary.MergedDictionaries>
  16. <common:TextLengthToVisibilityConverter x:Key="TextLengthToVisibilityConverter"></common:TextLengthToVisibilityConverter>
  17. <common:SubtractionConverter x:Key="SubtractionConverter"></common:SubtractionConverter>
  18. <common:AntiVisibilityConverter x:Key="AntiVisibilityConverter"></common:AntiVisibilityConverter>
  19. <common:BoolToVisibleConverter x:Key="BoolToVisibleConverter"></common:BoolToVisibleConverter>
  20. <common:BotaResourceConverter x:Key="BotaResourceConverter"></common:BotaResourceConverter>
  21. </ResourceDictionary>
  22. </UserControl.Resources>
  23. <Grid x:Name="ReplyGrid" Margin="0">
  24. <Grid.RowDefinitions>
  25. <RowDefinition Height="0"></RowDefinition>
  26. <RowDefinition Height="0"></RowDefinition>
  27. <RowDefinition Height="0"></RowDefinition>
  28. </Grid.RowDefinitions>
  29. <Grid Grid.Row="0">
  30. <TextBox x:Name="InputTxb" Height="30" VerticalContentAlignment="Center"></TextBox>
  31. <TextBlock Text="{Binding Converter={StaticResource BotaResourceConverter},ConverterParameter=Holder_Reply}" VerticalAlignment="Center" Margin="10,0,0,0" Foreground="#A0A0A0" IsHitTestVisible="False"
  32. Visibility="{Binding ElementName=InputTxb, Path=Text, Converter={StaticResource TextLengthToVisibilityConverter}}"></TextBlock>
  33. </Grid>
  34. <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
  35. <Button Content="{Binding Converter={StaticResource BotaResourceConverter},ConverterParameter=Button_Cancel}" Background="Transparent" BorderThickness="0" Margin="0,0,5,0" Width="56" Height="30" Click="ButtonCancel_Click"></Button>
  36. <Button Content="{Binding Converter={StaticResource BotaResourceConverter},ConverterParameter=Button_Reply}" Width="56" Height="30" Foreground="White" Background="#1460F3" BorderThickness="0" Click="ReplyButton_Click"></Button>
  37. </StackPanel>
  38. <ListView Grid.Row="2" x:Name="ReplyList" Margin="0,0,0,0" VirtualizingPanel.IsVirtualizingWhenGrouping="True"
  39. ScrollViewer.HorizontalScrollBarVisibility="Hidden" BorderThickness="0" SelectionMode="Single"
  40. Visibility="{Binding ElementName=ReplyList, Path=HasItems, Converter={StaticResource BoolToVisibleConverter}}">
  41. <ListView.ItemsPanel>
  42. <ItemsPanelTemplate>
  43. <VirtualizingStackPanel Background="#FAFCFF" HorizontalAlignment="Stretch" MaxHeight="200"
  44. Width="{Binding ActualWidth, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListView}, Converter={StaticResource SubtractionConverter}, ConverterParameter=5}"></VirtualizingStackPanel>
  45. </ItemsPanelTemplate>
  46. </ListView.ItemsPanel>
  47. <ListView.ItemContainerStyle>
  48. <Style TargetType="ListViewItem">
  49. <Setter Property="Template">
  50. <Setter.Value>
  51. <ControlTemplate TargetType="ListViewItem">
  52. <ContentPresenter />
  53. </ControlTemplate>
  54. </Setter.Value>
  55. </Setter>
  56. <Setter Property="MinHeight" Value="0" />
  57. <Setter Property="Height" Value="Auto" />
  58. </Style>
  59. </ListView.ItemContainerStyle>
  60. <ListView.ItemTemplate>
  61. <ItemContainerTemplate>
  62. <Grid>
  63. <Grid.Style>
  64. <Style TargetType="Grid">
  65. <Style.Triggers>
  66. <Trigger Property="IsMouseOver" Value="True">
  67. <Setter Property="Background" Value="#D0D9E1"/>
  68. </Trigger>
  69. <DataTrigger Binding="{Binding IsSelected, RelativeSource={RelativeSource AncestorType=ListViewItem}}" Value="True">
  70. <Setter Property="Background" Value="#D0D9E1"/>
  71. </DataTrigger>
  72. </Style.Triggers>
  73. </Style>
  74. </Grid.Style>
  75. <Grid.RowDefinitions>
  76. <RowDefinition Height="Auto"/>
  77. <RowDefinition Height="Auto"/>
  78. </Grid.RowDefinitions>
  79. <Grid.ColumnDefinitions>
  80. <ColumnDefinition Width="*"/>
  81. <ColumnDefinition Width="Auto"/>
  82. </Grid.ColumnDefinitions>
  83. <DockPanel Grid.Column="0">
  84. <StackPanel VerticalAlignment="Center">
  85. <TextBlock Text="{Binding Author}" FontSize="14" Foreground="#43474D" VerticalAlignment="Center"/>
  86. <TextBlock Text="{Binding Date}" FontSize="11" Foreground="#999999" VerticalAlignment="Center"/>
  87. </StackPanel>
  88. </DockPanel>
  89. <Menu Background="Transparent" BorderThickness="0" Grid.Column="1">
  90. <MenuItem BorderThickness="0" Width="30" Height="30" Padding="4,3,0,0">
  91. <MenuItem.Header>
  92. <Canvas Width="30" Height="30" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
  93. <Path Data="M10 5.5C10.8284 5.5 11.5 4.82843 11.5 4C11.5 3.17157 10.8284 2.5 10 2.5C9.17157 2.5 8.5 3.17157 8.5 4C8.5 4.82843 9.17157 5.5 10 5.5ZM11.5 10C11.5 10.8284 10.8284 11.5 10 11.5C9.17157 11.5 8.5 10.8284 8.5 10C8.5 9.17157 9.17157 8.5 10 8.5C10.8284 8.5 11.5 9.17157 11.5 10ZM11.5 16C11.5 16.8284 10.8284 17.5 10 17.5C9.17157 17.5 8.5 16.8284 8.5 16C8.5 15.1716 9.17157 14.5 10 14.5C10.8284 14.5 11.5 15.1716 11.5 16Z"
  94. Fill="#43474D"/>
  95. </Canvas>
  96. </MenuItem.Header>
  97. <MenuItem Header="{Binding Converter={StaticResource BotaResourceConverter},ConverterParameter=Menu_Edit}" Style="{StaticResource Sub_MenuItem}">
  98. <MenuItem.Command>
  99. <local:ShowContentBoxCommand/>
  100. </MenuItem.Command>
  101. <MenuItem.CommandParameter>
  102. <Binding ElementName="ContentBox"/>
  103. </MenuItem.CommandParameter>
  104. </MenuItem>
  105. <MenuItem Header="{Binding Converter={StaticResource BotaResourceConverter},ConverterParameter=Menu_Delete}" Style="{StaticResource Sub_MenuItem}">
  106. <MenuItem.Command>
  107. <local:DeleteReplyCommand/>
  108. </MenuItem.Command>
  109. <MenuItem.CommandParameter>
  110. <Binding Path="."></Binding>
  111. </MenuItem.CommandParameter>
  112. </MenuItem>
  113. </MenuItem>
  114. </Menu>
  115. <Grid Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2">
  116. <TextBox x:Name="ContentBox" Text="{Binding Content}" FontSize="14" Foreground="#666666" Margin="5,5,0,0"
  117. Visibility="Collapsed" VerticalAlignment="Center" LostFocus="ContentBox_LostFocus"></TextBox>
  118. <TextBlock Text="{Binding Content}" x:Name="ContentTxb" FontSize="14" Foreground="#666666" Margin="5,5,0,0" VerticalAlignment="Center"
  119. Visibility="{Binding ElementName=ContentBox,Path=Visibility,Converter={StaticResource AntiVisibilityConverter}}"></TextBlock>
  120. </Grid>
  121. </Grid>
  122. </ItemContainerTemplate>
  123. </ListView.ItemTemplate>
  124. </ListView>
  125. </Grid>
  126. </UserControl>