ux: hide if image not exists

This commit is contained in:
leo 2024-06-21 23:52:40 +08:00
parent d23740d9e8
commit 7a5279f717

View file

@ -20,48 +20,52 @@
<TabItem.Header> <TabItem.Header>
<TextBlock Text="SIDE-BY-SIDE" FontSize="11"/> <TextBlock Text="SIDE-BY-SIDE" FontSize="11"/>
</TabItem.Header> </TabItem.Header>
<Grid ColumnDefinitions="*,32,*" RowDefinitions="Auto,*" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="8,16">
<StackPanel Grid.Row="0" Grid.Column="0" Orientation="Horizontal" HorizontalAlignment="Center">
<Border Height="16" Background="{DynamicResource Brush.Badge}" CornerRadius="8" VerticalAlignment="Center">
<TextBlock Classes="monospace" Text="{DynamicResource Text.Diff.Binary.Old}" Margin="8,0" FontSize="10"/>
</Border>
<TextBlock Grid.Column="1" Classes="monospace" Text="{Binding OldImageSize}" Margin="8,0,0,0"/> <UniformGrid Rows="1" Margin="8,16" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Grid.Column="2" Classes="monospace" Text="{Binding OldFileSize}" Foreground="{DynamicResource Brush.FG2}" Margin="16,0,0,0" HorizontalAlignment="Right"/> <Grid RowDefinitions="Auto,*" IsVisible="{Binding Old, Converter={x:Static ObjectConverters.IsNotNull}}">
<TextBlock Grid.Column="3" Classes="monospace" Text="{DynamicResource Text.Bytes}" Foreground="{DynamicResource Brush.FG2}" Margin="2,0,0,0"/> <StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Center">
</StackPanel> <Border Height="16" Background="{DynamicResource Brush.Badge}" CornerRadius="8" VerticalAlignment="Center">
<TextBlock Classes="monospace" Text="{DynamicResource Text.Diff.Binary.Old}" Margin="8,0" FontSize="10"/>
</Border>
<Border Grid.Row="1" Grid.Column="0" Margin="0,12,0,0" Effect="drop-shadow(0 0 8 #A0000000)"> <TextBlock Grid.Column="1" Classes="monospace" Text="{Binding OldImageSize}" Margin="8,0,0,0"/>
<Border Background="{DynamicResource Brush.Popup}" HorizontalAlignment="Center" Padding="8"> <TextBlock Grid.Column="2" Classes="monospace" Text="{Binding OldFileSize}" Foreground="{DynamicResource Brush.FG2}" Margin="16,0,0,0" HorizontalAlignment="Right"/>
<Border BorderThickness="1" BorderBrush="{DynamicResource Brush.Border1}"> <TextBlock Grid.Column="3" Classes="monospace" Text="{DynamicResource Text.Bytes}" Foreground="{DynamicResource Brush.FG2}" Margin="2,0,0,0"/>
<v:ImageContainer> </StackPanel>
<Image Source="{Binding Old}" Stretch="Uniform" VerticalAlignment="Center"/>
</v:ImageContainer> <Border Grid.Row="1" Margin="0,12,0,0" Effect="drop-shadow(0 0 8 #A0000000)">
<Border Background="{DynamicResource Brush.Popup}" HorizontalAlignment="Center" Padding="8">
<Border BorderThickness="1" BorderBrush="{DynamicResource Brush.Border1}">
<v:ImageContainer>
<Image Source="{Binding Old}" Stretch="Uniform" VerticalAlignment="Center"/>
</v:ImageContainer>
</Border>
</Border> </Border>
</Border> </Border>
</Border> </Grid>
<Grid RowDefinitions="Auto,*" Margin="32,0,0,0" IsVisible="{Binding New, Converter={x:Static ObjectConverters.IsNotNull}}">
<StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Center">
<Border Height="16" Background="Green" CornerRadius="8" VerticalAlignment="Center">
<TextBlock Classes="monospace" Text="{DynamicResource Text.Diff.Binary.New}" Margin="8,0" FontSize="10"/>
</Border>
<StackPanel Grid.Row="0" Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Center"> <TextBlock Grid.Column="1" Classes="monospace" Text="{Binding NewImageSize}" Margin="8,0,0,0"/>
<Border Height="16" Background="Green" CornerRadius="8" VerticalAlignment="Center"> <TextBlock Grid.Column="2" Classes="monospace" Text="{Binding NewFileSize}" Foreground="{DynamicResource Brush.FG2}" Margin="16,0,0,0" HorizontalAlignment="Right"/>
<TextBlock Classes="monospace" Text="{DynamicResource Text.Diff.Binary.New}" Margin="8,0" FontSize="10"/> <TextBlock Grid.Column="3" Classes="monospace" Text="{DynamicResource Text.Bytes}" Foreground="{DynamicResource Brush.FG2}" Margin="2,0,0,0"/>
</Border> </StackPanel>
<TextBlock Grid.Column="1" Classes="monospace" Text="{Binding NewImageSize}" Margin="8,0,0,0"/> <Border Grid.Row="1" Margin="0,12,0,0" Effect="drop-shadow(0 0 8 #A0000000)">
<TextBlock Grid.Column="2" Classes="monospace" Text="{Binding NewFileSize}" Foreground="{DynamicResource Brush.FG2}" Margin="16,0,0,0" HorizontalAlignment="Right"/> <Border Background="{DynamicResource Brush.Popup}" HorizontalAlignment="Center" Padding="8">
<TextBlock Grid.Column="3" Classes="monospace" Text="{DynamicResource Text.Bytes}" Foreground="{DynamicResource Brush.FG2}" Margin="2,0,0,0"/> <Border BorderThickness="1" BorderBrush="{DynamicResource Brush.Border1}">
</StackPanel> <v:ImageContainer>
<Image Source="{Binding New}" Stretch="Uniform" VerticalAlignment="Center"/>
<Border Grid.Row="1" Grid.Column="2" Margin="0,12,0,0" Effect="drop-shadow(0 0 8 #A0000000)"> </v:ImageContainer>
<Border Background="{DynamicResource Brush.Popup}" HorizontalAlignment="Center" Padding="8"> </Border>
<Border BorderThickness="1" BorderBrush="{DynamicResource Brush.Border1}">
<v:ImageContainer>
<Image Source="{Binding New}" Stretch="Uniform"/>
</v:ImageContainer>
</Border> </Border>
</Border> </Border>
</Border> </Grid>
</Grid> </UniformGrid>
</TabItem> </TabItem>
<TabItem> <TabItem>