Skip to content

Commit

Permalink
数据列显示优化
Browse files Browse the repository at this point in the history
  • Loading branch information
lim committed Sep 29, 2022
1 parent 0e69d19 commit afb0307
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 14 deletions.
12 changes: 6 additions & 6 deletions Lux_GUI/PlayList.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,19 @@
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridCell}">
<Grid Background="{TemplateBinding Background}">
<ContentPresenter HorizontalAlignment="Left" VerticalAlignment="Center" />
<ContentPresenter HorizontalAlignment="Left" Margin="13,0" VerticalAlignment="Center" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</DataGrid.Resources>
<DataGrid.Columns>
<DataGridTextColumn Header="网站" Binding="{Binding Site}" MinWidth="200" Width="auto" IsReadOnly="True" />
<DataGridTextColumn Header="标题" Binding="{Binding Title}" MinWidth="300" Width="*" IsReadOnly="True" />
<DataGridTextColumn Header="流名称" Binding="{Binding Name}" MinWidth="50" Width="auto" IsReadOnly="True" />
<DataGridTextColumn Header="质量" Binding="{Binding Quality}" MinWidth="200" Width="auto" IsReadOnly="True" />
<DataGridTextColumn Header="大小" Binding="{Binding Size}" MinWidth="200" Width="auto" IsReadOnly="True" />
<!--<DataGridTextColumn Header="网站" Binding="{Binding Site}" MinWidth="200" Width="auto" IsReadOnly="True" />-->
<DataGridTextColumn Header="标题" Binding="{Binding Title}" Width="3*" IsReadOnly="True" />
<DataGridTextColumn Header="流名称" Binding="{Binding Name}" Width="150" IsReadOnly="True" />
<DataGridTextColumn Header="质量" Binding="{Binding Quality}" Width="*" IsReadOnly="True" />
<DataGridTextColumn Header="大小" Binding="{Binding Size}" Width="*" IsReadOnly="True" />
</DataGrid.Columns>
</DataGrid>
<StackPanel Grid.Row="1" Margin="10,5" VerticalAlignment="Center" Orientation="Horizontal" Height="auto">
Expand Down
30 changes: 22 additions & 8 deletions Lux_GUI/SingleFile.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
<RowDefinition Height="50" />
</Grid.RowDefinitions>

<DataGrid Grid.Row="0" ItemsSource="{Binding StreamsView,Mode=OneWay}" AutoGenerateColumns="False" RowHeight="50">
<DataGrid Grid.Row="0" ItemsSource="{Binding StreamsView,Mode=OneWay}" AutoGenerateColumns="False" RowHeight="50" x:Name="datagrid">
<DataGrid.Resources>
<Style TargetType="TextBlock" BasedOn="{StaticResource MaterialDesignBody1TextBlock}" x:Key="vCenter">
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>

<Style TargetType="DataGridCell" BasedOn="{StaticResource MaterialDesignDataGridCell}">
<!--<Style TargetType="DataGridCell" BasedOn="{StaticResource MaterialDesignDataGridCell}">
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Template">
Expand All @@ -43,15 +43,29 @@
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>-->

<Style TargetType="DataGridCell" BasedOn="{StaticResource MaterialDesignDataGridCell}">
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridCell}">
<Grid Background="{TemplateBinding Background}">
<ContentPresenter HorizontalAlignment="Left" Margin="13,0" VerticalAlignment="Center" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</DataGrid.Resources>
<DataGrid.Columns>
<DataGridTextColumn Header="网站" Binding="{Binding Site}" MinWidth="200" Width="auto" IsReadOnly="True" />
<DataGridTextColumn Header="标题" Binding="{Binding Title}" MinWidth="300" Width="*" IsReadOnly="True" />
<DataGridTextColumn Header="流名称" Binding="{Binding Name}" MinWidth="50" Width="auto" IsReadOnly="True" />
<DataGridTextColumn Header="质量" Binding="{Binding Quality}" MinWidth="200" Width="auto" IsReadOnly="True" />
<DataGridTextColumn Header="大小" Binding="{Binding Size}" MinWidth="200" Width="auto" IsReadOnly="True" />
<DataGridTemplateColumn Header="操作" Width="80">
<!--<DataGridTextColumn Header="网站" Binding="{Binding Site}" Width="*" IsReadOnly="True" />
<DataGridTextColumn Header="标题" Binding="{Binding Title}" Width="3*" IsReadOnly="True" />-->
<DataGridTextColumn Header="流名称" Binding="{Binding Name}" Width="150" IsReadOnly="True" />
<DataGridTextColumn Header="质量" Binding="{Binding Quality}" Width="*" IsReadOnly="True" />
<DataGridTextColumn Header="大小" Binding="{Binding Size}" Width="*" IsReadOnly="True" />
<DataGridTemplateColumn Header="操作" Width="120">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Content="下载" Style="{StaticResource MaterialDesignFlatAccentButton}" Margin="3,1" Click="BtnAction_Click" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/>
Expand Down
1 change: 1 addition & 0 deletions Lux_GUI/SingleFile.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ public void Parser(string InputUrl)
{
this.Dispatcher.BeginInvoke(new Action(() =>
{
datagrid.UpdateLayout();
DialogHost.Close("RootDialog");
ComboboxView.Refresh();
}));
Expand Down

0 comments on commit afb0307

Please sign in to comment.