chore: update ImageBrowser style.

This commit is contained in:
NaBian committed 2023-01-20 14:48:37 +08:00
1 parent d0c14de606
commit b5dfc484fd
5 files changed
+5 -28

No files matched your search

@@ -1,6 +1,5 @@
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Windows;
using System.Windows.Controls;
@@ -952,29 +951,7 @@ public class ImageViewer : Control
private static void OnUriChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var self = (ImageViewer) d;
if (e.NewValue is Uri uri)
{
self.ImageSource = GetBitmapFrame(uri);
self.Init();
}
else
{
self.ImageSource = null;
}
static BitmapFrame GetBitmapFrame(Uri source)
{
try
{
return BitmapFrame.Create(source);
}
catch
{
return null;
}
}
((ImageViewer) d).OnUriChanged((Uri) e.NewValue);
}
private void OnUriChanged(Uri newValue)
@@ -313,7 +313,7 @@
<TextBlock Text="{Binding ImgPath,ElementName=PART_ImageViewer}" Foreground="White" Margin="10,0,0,0"/>
<TextBlock Text="{Binding ImgSize,ElementName=PART_ImageViewer,Converter={StaticResource Long2FileSizeConverter}}" Foreground="White" Margin="30,0,0,0"/>
</StackPanel>
<Button Command="interactivity:ControlCommands.Close" WindowChrome.IsHitTestVisibleInChrome="True" Background="Red" Padding="14" hc:IconElement.Geometry="{StaticResource DeleteGeometry}" Style="{StaticResource ButtonIcon}" HorizontalAlignment="Right" VerticalAlignment="Top" Width="40" Height="40"/>
<Button Command="interactivity:ControlCommands.Close" Foreground="{DynamicResource TextIconBrush}" WindowChrome.IsHitTestVisibleInChrome="True" Background="Red" Padding="14" hc:IconElement.Geometry="{StaticResource DeleteGeometry}" Style="{StaticResource ButtonIcon}" HorizontalAlignment="Right" VerticalAlignment="Top" Width="40" Height="40"/>
</hc:SimplePanel>
</Grid>
<ControlTemplate.Triggers>
@@ -5036,7 +5036,7 @@
<TextBlock Text="{Binding ImgPath,ElementName=PART_ImageViewer}" Foreground="White" Margin="10,0,0,0" />
<TextBlock Text="{Binding ImgSize,ElementName=PART_ImageViewer,Converter={StaticResource Long2FileSizeConverter}}" Foreground="White" Margin="30,0,0,0" />
</StackPanel>
<Button Command="interactivity:ControlCommands.Close" WindowChrome.IsHitTestVisibleInChrome="True" Background="Red" Padding="14" hc:IconElement.Geometry="{StaticResource DeleteGeometry}" Style="{StaticResource ButtonIcon}" HorizontalAlignment="Right" VerticalAlignment="Top" Width="40" Height="40" />
<Button Command="interactivity:ControlCommands.Close" Foreground="{DynamicResource TextIconBrush}" WindowChrome.IsHitTestVisibleInChrome="True" Background="Red" Padding="14" hc:IconElement.Geometry="{StaticResource DeleteGeometry}" Style="{StaticResource ButtonIcon}" HorizontalAlignment="Right" VerticalAlignment="Top" Width="40" Height="40" />
</hc:SimplePanel>
</Grid>
<ControlTemplate.Triggers>