Skip to content

Commit

Permalink
apply suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
tangge233 committed Nov 14, 2024
1 parent 5e7d57c commit 6e24a7c
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 9 deletions.
15 changes: 8 additions & 7 deletions Plain Craft Launcher 2/Controls/MyListItem.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
<ColumnDefinition x:Name="ColumnCheck" Width="2"/>
<ColumnDefinition x:Name="ColumnPaddingLeft" Width="0" />
<ColumnDefinition x:Name="ColumnLogo" Width="4" />
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition x:Name="ColumnPaddingRight" Width="4" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
Expand All @@ -21,14 +22,14 @@
</Grid.RowDefinitions>
<!--<Border x:Name="RectBack" CornerRadius="3" RenderTransformOrigin="0.5,0.5" SnapsToDevicePixels="True" IsHitTestVisible="False" Opacity="0" Grid.ColumnSpan="4" Background="{DynamicResource ColorBrush7}" BorderBrush="{DynamicResource ColorBrush6}" BorderThickness="1" />-->
<!--<StackPanel VerticalAlignment="Center">-->
<TextBlock Grid.Row="1" SnapsToDevicePixels="False" UseLayoutRounding="False" HorizontalAlignment="Left" x:Name="LabTitle" IsHitTestVisible="False" Grid.Column="3" Text="{Binding Title, ElementName=PanBack}" TextTrimming="CharacterEllipsis" FontSize="{Binding FontSize, ElementName=PanBack}" Foreground="{Binding Foreground, ElementName=PanBack}" Margin="4,0,0,0" />
<StackPanel Orientation="Horizontal" x:Name="PanInfo" Grid.Row="2" Grid.Column="3" Visibility="Collapsed" IsHitTestVisible="False">
<TextBlock Grid.Row="1" SnapsToDevicePixels="False" UseLayoutRounding="False" HorizontalAlignment="Left" x:Name="LabTitle" IsHitTestVisible="False" Grid.Column="3" Grid.ColumnSpan="2" Text="{Binding Title, ElementName=PanBack}" TextTrimming="CharacterEllipsis" FontSize="{Binding FontSize, ElementName=PanBack}" Foreground="{Binding Foreground, ElementName=PanBack}" Margin="4,0,0,0" />
<!--<StackPanel Orientation="Horizontal" x:Name="PanInfo" Grid.Row="2" Grid.Column="3" Visibility="Collapsed" IsHitTestVisible="False">
<StackPanel x:Name="PanTags" Orientation="Horizontal" VerticalAlignment="Bottom" Margin="0,0,-3,0">
<!--<Border Background="{DynamicResource ColorBrush6}" Padding="3,1" CornerRadius="3" Margin="0,0,4,0" SnapsToDevicePixels="True" UseLayoutRounding="False">
<Border Background="{DynamicResource ColorBrush6}" Padding="3,1" CornerRadius="3" Margin="0,0,4,0" SnapsToDevicePixels="True" UseLayoutRounding="False">
<TextBlock Text="科技" Foreground="{DynamicResource ColorBrush2}" FontSize="11" />
</Border>-->
</Border>
</StackPanel>
<!--<TextBlock Grid.Row="2" SnapsToDevicePixels="False" UseLayoutRounding="False" HorizontalAlignment="Left" x:Name="LabInfo" IsHitTestVisible="False" Grid.Column="2" TextTrimming="CharacterEllipsis" Visibility="Collapsed" FontSize="12" Foreground="{StaticResource ColorBrushGray2}" Margin="4,0,0,0" />-->
</StackPanel>
<TextBlock Grid.Row="2" SnapsToDevicePixels="False" UseLayoutRounding="False" HorizontalAlignment="Left" x:Name="LabInfo" IsHitTestVisible="False" Grid.Column="2" TextTrimming="CharacterEllipsis" Visibility="Collapsed" FontSize="12" Foreground="{StaticResource ColorBrushGray2}" Margin="4,0,0,0" />
</StackPanel>-->
<!--</StackPanel>-->
</Grid>
31 changes: 29 additions & 2 deletions Plain Craft Launcher 2/Controls/MyListItem.xaml.vb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,31 @@
'勾选条
Public RectCheck As Border


''' <summary>
''' Tags 的存放 StackPanel
''' </summary>
Public _PanTags As StackPanel
Public ReadOnly Property PanTags As StackPanel
Get
If _PanTags IsNot Nothing Then Return _PanTags
Dim NewStack As New StackPanel With {
.IsHitTestVisible = False,
.Orientation = Orientation.Horizontal,
.VerticalAlignment = VerticalAlignment.Bottom,
.Margin = New Thickness(0, 0, -3, 0)
}
SetColumn(NewStack, 3)
SetRow(NewStack, 2)
PanBack.Children.Add(NewStack)
_PanTags = NewStack
Return _PanTags
End Get
End Property

''' <summary>
''' 标签,可以传入 String 和 List(Of String)
''' </summary>
Public WriteOnly Property Tags As Object
Set(value As Object)
Dim list As New List(Of String)
Expand All @@ -56,6 +81,7 @@
list = CType(value, List(Of String))
End If
PanTags.Children.Clear()
PanTags.Visibility = If(list.Any(), Visibility.Visible, Visibility.Collapsed)
For Each TagText In list
Dim NewTag As New Border With {
.Background = New SolidColorBrush(Color.FromArgb(17, 0, 0, 0)),
Expand Down Expand Up @@ -93,8 +119,9 @@
.Margin = New Thickness(4, 0, 0, 0),
.Opacity = 0.6
}
PanInfo.Children.Add(Lab)
PanInfo.Visibility = Visibility.Visible
SetColumn(Lab, 4)
SetRow(Lab, 2)
PanBack.Children.Add(Lab)
_LabInfo = Lab
'<TextBlock Grid.Row="2" SnapsToDevicePixels="False" UseLayoutRounding="False" HorizontalAlignment="Left" x:Name = "LabInfo" IsHitTestVisible="False" Grid.Column="2"
'TextTrimming = "CharacterEllipsis" Visibility="Collapsed" FontSize="12" Foreground="{StaticResource ColorBrushGray2}" Margin="4,0,0,0" />
Expand Down

0 comments on commit 6e24a7c

Please sign in to comment.