feature: make parents and children scrollable

This commit is contained in:
Dmitrij D. Czarkoff 2024-11-19 19:13:34 +01:00
parent e8c8ac55a1
commit 34b2451d1d
No known key found for this signature in database

View file

@ -102,89 +102,93 @@
<!-- PARENTS --> <!-- PARENTS -->
<TextBlock Grid.Row="1" Grid.Column="0" Classes="info_label" Text="{DynamicResource Text.CommitDetail.Info.Parents}" IsVisible="{Binding Parents.Count, Converter={x:Static c:IntConverters.IsGreaterThanZero}}"/> <TextBlock Grid.Row="1" Grid.Column="0" Classes="info_label" Text="{DynamicResource Text.CommitDetail.Info.Parents}" IsVisible="{Binding Parents.Count, Converter={x:Static c:IntConverters.IsGreaterThanZero}}"/>
<ItemsControl Grid.Row="1" Grid.Column="1" Height="24" Margin="12,0,0,0" ItemsSource="{Binding Parents}" IsVisible="{Binding Parents.Count, Converter={x:Static c:IntConverters.IsGreaterThanZero}}"> <ScrollViewer Grid.Row="1" Grid.Column="1" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Hidden" AllowAutoHide="True">
<ItemsControl.ItemsPanel> <ItemsControl Height="24" Margin="12,0,0,0" ItemsSource="{Binding Parents}" IsVisible="{Binding Parents.Count, Converter={x:Static c:IntConverters.IsGreaterThanZero}}">
<ItemsPanelTemplate> <ItemsControl.ItemsPanel>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center"/> <ItemsPanelTemplate>
</ItemsPanelTemplate> <StackPanel Orientation="Horizontal" VerticalAlignment="Center"/>
</ItemsControl.ItemsPanel> </ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate> <ItemsControl.ItemTemplate>
<DataTemplate> <DataTemplate>
<TextBlock Classes="primary" <TextBlock Classes="primary"
Text="{Binding Converter={x:Static c:StringConverters.ToShortSHA}}" Text="{Binding Converter={x:Static c:StringConverters.ToShortSHA}}"
Foreground="DarkOrange" Foreground="DarkOrange"
TextDecorations="Underline" TextDecorations="Underline"
Cursor="Hand" Cursor="Hand"
Margin="0,0,16,0" Margin="0,0,16,0"
PointerEntered="OnSHAPointerEntered" PointerEntered="OnSHAPointerEntered"
PointerPressed="OnSHAPressed"> PointerPressed="OnSHAPressed">
<TextBlock.Styles> <TextBlock.Styles>
<Style Selector="ToolTip"> <Style Selector="ToolTip">
<Setter Property="MaxWidth" Value="600"/> <Setter Property="MaxWidth" Value="600"/>
</Style> </Style>
</TextBlock.Styles> </TextBlock.Styles>
<TextBlock.DataTemplates> <TextBlock.DataTemplates>
<DataTemplate DataType="m:Commit"> <DataTemplate DataType="m:Commit">
<StackPanel MinWidth="400" Orientation="Vertical"> <StackPanel MinWidth="400" Orientation="Vertical">
<Grid ColumnDefinitions="Auto,*,Auto"> <Grid ColumnDefinitions="Auto,*,Auto">
<v:Avatar Grid.Column="0" Width="16" Height="16" VerticalAlignment="Center" IsHitTestVisible="False" User="{Binding Author}"/> <v:Avatar Grid.Column="0" Width="16" Height="16" VerticalAlignment="Center" IsHitTestVisible="False" User="{Binding Author}"/>
<TextBlock Grid.Column="1" Classes="primary" Text="{Binding Author.Name}" Margin="8,0,0,0"/> <TextBlock Grid.Column="1" Classes="primary" Text="{Binding Author.Name}" Margin="8,0,0,0"/>
<TextBlock Grid.Column="2" Classes="primary" Text="{Binding CommitterTimeStr}" Foreground="{DynamicResource Brush.FG2}" Margin="8,0,0,0"/> <TextBlock Grid.Column="2" Classes="primary" Text="{Binding CommitterTimeStr}" Foreground="{DynamicResource Brush.FG2}" Margin="8,0,0,0"/>
</Grid> </Grid>
<TextBlock Classes="primary" Margin="0,8,0,0" Text="{Binding Subject}" TextWrapping="Wrap"/> <TextBlock Classes="primary" Margin="0,8,0,0" Text="{Binding Subject}" TextWrapping="Wrap"/>
</StackPanel> </StackPanel>
</DataTemplate> </DataTemplate>
</TextBlock.DataTemplates> </TextBlock.DataTemplates>
</TextBlock> </TextBlock>
</DataTemplate> </DataTemplate>
</ItemsControl.ItemTemplate> </ItemsControl.ItemTemplate>
</ItemsControl> </ItemsControl>
</ScrollViewer>
<!-- CHILDREN --> <!-- CHILDREN -->
<TextBlock Grid.Row="2" Grid.Column="0" Classes="info_label" Text="{DynamicResource Text.CommitDetail.Info.Children}" IsVisible="{Binding #ThisControl.Children.Count, Converter={x:Static c:IntConverters.IsGreaterThanZero}}"/> <TextBlock Grid.Row="2" Grid.Column="0" Classes="info_label" Text="{DynamicResource Text.CommitDetail.Info.Children}" IsVisible="{Binding #ThisControl.Children.Count, Converter={x:Static c:IntConverters.IsGreaterThanZero}}"/>
<ItemsControl Grid.Row="2" Grid.Column="1" Height="24" Margin="12,0,0,0" ItemsSource="{Binding #ThisControl.Children}" IsVisible="{Binding #ThisControl.Children.Count, Converter={x:Static c:IntConverters.IsGreaterThanZero}}"> <ScrollViewer Grid.Row="2" Grid.Column="1" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Hidden" AllowAutoHide="True">
<ItemsControl.ItemsPanel> <ItemsControl Height="24" Margin="12,0,0,0" ItemsSource="{Binding #ThisControl.Children}" IsVisible="{Binding #ThisControl.Children.Count, Converter={x:Static c:IntConverters.IsGreaterThanZero}}">
<ItemsPanelTemplate> <ItemsControl.ItemsPanel>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center"/> <ItemsPanelTemplate>
</ItemsPanelTemplate> <StackPanel Orientation="Horizontal" VerticalAlignment="Center"/>
</ItemsControl.ItemsPanel> </ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate> <ItemsControl.ItemTemplate>
<DataTemplate> <DataTemplate>
<TextBlock Classes="primary" <TextBlock Classes="primary"
Text="{Binding Converter={x:Static c:StringConverters.ToShortSHA}}" Text="{Binding Converter={x:Static c:StringConverters.ToShortSHA}}"
Foreground="DarkOrange" Foreground="DarkOrange"
TextDecorations="Underline" TextDecorations="Underline"
Cursor="Hand" Cursor="Hand"
Margin="0,0,16,0" Margin="0,0,16,0"
PointerEntered="OnSHAPointerEntered" PointerEntered="OnSHAPointerEntered"
PointerPressed="OnSHAPressed"> PointerPressed="OnSHAPressed">
<TextBlock.Styles> <TextBlock.Styles>
<Style Selector="ToolTip"> <Style Selector="ToolTip">
<Setter Property="MaxWidth" Value="600"/> <Setter Property="MaxWidth" Value="600"/>
</Style> </Style>
</TextBlock.Styles> </TextBlock.Styles>
<TextBlock.DataTemplates> <TextBlock.DataTemplates>
<DataTemplate DataType="m:Commit"> <DataTemplate DataType="m:Commit">
<StackPanel MinWidth="400" Orientation="Vertical"> <StackPanel MinWidth="400" Orientation="Vertical">
<Grid ColumnDefinitions="Auto,*,Auto"> <Grid ColumnDefinitions="Auto,*,Auto">
<v:Avatar Grid.Column="0" Width="16" Height="16" VerticalAlignment="Center" IsHitTestVisible="False" User="{Binding Author}"/> <v:Avatar Grid.Column="0" Width="16" Height="16" VerticalAlignment="Center" IsHitTestVisible="False" User="{Binding Author}"/>
<TextBlock Grid.Column="1" Classes="primary" Text="{Binding Author.Name}" Margin="8,0,0,0"/> <TextBlock Grid.Column="1" Classes="primary" Text="{Binding Author.Name}" Margin="8,0,0,0"/>
<TextBlock Grid.Column="2" Classes="primary" Text="{Binding CommitterTimeStr}" Foreground="{DynamicResource Brush.FG2}" Margin="8,0,0,0"/> <TextBlock Grid.Column="2" Classes="primary" Text="{Binding CommitterTimeStr}" Foreground="{DynamicResource Brush.FG2}" Margin="8,0,0,0"/>
</Grid> </Grid>
<TextBlock Classes="primary" Margin="0,8,0,0" Text="{Binding Subject}" TextWrapping="Wrap"/> <TextBlock Classes="primary" Margin="0,8,0,0" Text="{Binding Subject}" TextWrapping="Wrap"/>
</StackPanel> </StackPanel>
</DataTemplate> </DataTemplate>
</TextBlock.DataTemplates> </TextBlock.DataTemplates>
</TextBlock> </TextBlock>
</DataTemplate> </DataTemplate>
</ItemsControl.ItemTemplate> </ItemsControl.ItemTemplate>
</ItemsControl> </ItemsControl>
</ScrollViewer>
<!-- REFS --> <!-- REFS -->
<TextBlock Grid.Row="3" Grid.Column="0" Classes="info_label" Text="{DynamicResource Text.CommitDetail.Info.Refs}" IsVisible="{Binding HasDecorators}"/> <TextBlock Grid.Row="3" Grid.Column="0" Classes="info_label" Text="{DynamicResource Text.CommitDetail.Info.Refs}" IsVisible="{Binding HasDecorators}"/>