Files
IOT/MainModule/Views/PostDetailView.xaml
2026-01-14 15:32:10 +08:00

108 lines
6.1 KiB
XML

<UserControl x:Class="MainModule.Views.PostDetailView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:converters="clr-namespace:UIShare.Converters;assembly=UIShare"
mc:Ignorable="d"
xmlns:prism="http://prismlibrary.com/"
prism:ViewModelLocator.AutoWireViewModel="True"
d:DesignHeight="800"
d:DesignWidth="1000">
<UserControl.Resources>
<converters:BooleanToVisibilityConverter x:Key="BoolToVis" />
</UserControl.Resources>
<Grid Margin="20">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- 帖子头部信息 -->
<Border Grid.Row="0" Background="White" CornerRadius="8" BorderBrush="#E0E0E0" BorderThickness="1" Padding="20">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Ellipse Grid.Column="0" Width="50" Height="50" Fill="#BDBDBD" VerticalAlignment="Center"/>
<StackPanel Grid.Column="1" Margin="15,0,0,0" VerticalAlignment="Center">
<TextBlock Text="{Binding SelectedPost.AuthorName}" FontSize="16" FontWeight="Medium" Foreground="#212121"/>
<TextBlock Text="{Binding SelectedPost.PublishTime, StringFormat=\\{0:yyyy-MM-dd HH:mm:ss\\}}" FontSize="12" Foreground="#757575" Margin="0,2,0,0"/>
</StackPanel>
<StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right" >
<Border Background="#FF9800" Padding="8,4" CornerRadius="4" Visibility="{Binding SelectedPost.IsEssence, Converter={StaticResource BoolToVis}}">
<TextBlock Text="精" FontSize="12" Foreground="White" FontWeight="Bold"/>
</Border>
<Border Background="#2196F3" Padding="8,4" CornerRadius="4" Visibility="{Binding SelectedPost.IsTop, Converter={StaticResource BoolToVis}}">
<TextBlock Text="顶" FontSize="12" Foreground="White" FontWeight="Bold"/>
</Border>
</StackPanel>
</Grid>
</Border>
<!-- 帖子内容区域 -->
<Border Grid.Row="1" Background="White" CornerRadius="8" BorderBrush="#E0E0E0" BorderThickness="1" Margin="0,10,0,10" Padding="20">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<StackPanel>
<TextBlock Text="{Binding SelectedPost.Title}" FontSize="24" FontWeight="Bold" Foreground="#212121" Margin="0,0,0,20"/>
<TextBlock Text="{Binding SelectedPost.Content}" FontSize="16" Foreground="#424242" TextWrapping="Wrap" LineHeight="28"/>
</StackPanel>
</ScrollViewer>
</Border>
<!-- 统计信息和操作区域 -->
<Border Grid.Row="2" Background="White" CornerRadius="8" BorderBrush="#E0E0E0" BorderThickness="1" Padding="20">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal" >
<StackPanel Orientation="Horizontal" >
<materialDesign:PackIcon Kind="Eye" Height="20" Width="20" Foreground="#757575"/>
<TextBlock Text="{Binding SelectedPost.ViewCount}" Foreground="#757575" FontSize="14"/>
</StackPanel>
<StackPanel Orientation="Horizontal" >
<materialDesign:PackIcon Kind="ThumbUpOutline" Height="20" Width="20" Foreground="#757575"/>
<TextBlock Text="{Binding SelectedPost.LikeCount}" Foreground="#757575" FontSize="14"/>
</StackPanel>
<StackPanel Orientation="Horizontal" >
<materialDesign:PackIcon Kind="CommentOutline" Height="20" Width="20" Foreground="#757575"/>
<TextBlock Text="{Binding SelectedPost.CommentCount}" Foreground="#757575" FontSize="14"/>
</StackPanel>
<TextBlock Text="{Binding SelectedPost.Category}" Foreground="#2196F3" FontSize="14" FontWeight="Medium" VerticalAlignment="Center"/>
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal">
<Button Content="点赞"
Style="{StaticResource MaterialDesignRaisedLightButton}"
Background="#4CAF50"
Foreground="White"
Command="{Binding LikePostCommand}"/>
<Button Content="收藏"
Style="{StaticResource MaterialDesignRaisedLightButton}"
Background="#FF9800"
Foreground="White"
Command="{Binding FavoritePostCommand}"/>
<Button Content="分享"
Style="{StaticResource MaterialDesignRaisedLightButton}"
Background="#2196F3"
Foreground="White"
Command="{Binding SharePostCommand}"/>
</StackPanel>
</Grid>
</Border>
</Grid>
</UserControl>