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

@@ -315,7 +315,7 @@
<TextBlock Text="{Binding ImgPath,ElementName=PART_ImageViewer}" Foreground="White" Margin="10,0,0,0"/> <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"/> <TextBlock Text="{Binding ImgSize,ElementName=PART_ImageViewer,Converter={StaticResource Long2FileSizeConverter}}" Foreground="White" Margin="30,0,0,0"/>
</StackPanel> </StackPanel>
<Button Command="interactivity:ControlCommands.Close" shell:WindowChrome.IsHitTestVisibleInChrome="True" Background="Red" Grid.Row="0" 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}" shell:WindowChrome.IsHitTestVisibleInChrome="True" Background="Red" Grid.Row="0" Padding="14" hc:IconElement.Geometry="{StaticResource DeleteGeometry}" Style="{StaticResource ButtonIcon}" HorizontalAlignment="Right" VerticalAlignment="Top" Width="40" Height="40"/>
</Grid> </Grid>
</Grid> </Grid>
<ControlTemplate.Triggers> <ControlTemplate.Triggers>
@@ -5037,7 +5037,7 @@
<TextBlock Text="{Binding ImgPath,ElementName=PART_ImageViewer}" Foreground="White" Margin="10,0,0,0" /> <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" /> <TextBlock Text="{Binding ImgSize,ElementName=PART_ImageViewer,Converter={StaticResource Long2FileSizeConverter}}" Foreground="White" Margin="30,0,0,0" />
</StackPanel> </StackPanel>
<Button Command="interactivity:ControlCommands.Close" shell:WindowChrome.IsHitTestVisibleInChrome="True" Background="Red" Grid.Row="0" 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}" shell:WindowChrome.IsHitTestVisibleInChrome="True" Background="Red" Grid.Row="0" Padding="14" hc:IconElement.Geometry="{StaticResource DeleteGeometry}" Style="{StaticResource ButtonIcon}" HorizontalAlignment="Right" VerticalAlignment="Top" Width="40" Height="40" />
</Grid> </Grid>
</Grid> </Grid>
<ControlTemplate.Triggers> <ControlTemplate.Triggers>
@@ -1,6 +1,5 @@
using System; using System;
using System.ComponentModel; using System.ComponentModel;
using System.Diagnostics;
using System.IO; using System.IO;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
@@ -952,29 +951,7 @@ public class ImageViewer : Control
private static void OnUriChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnUriChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var self = (ImageViewer) d; ((ImageViewer) d).OnUriChanged((Uri) e.NewValue);
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;
}
}
} }
private void OnUriChanged(Uri 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 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"/> <TextBlock Text="{Binding ImgSize,ElementName=PART_ImageViewer,Converter={StaticResource Long2FileSizeConverter}}" Foreground="White" Margin="30,0,0,0"/>
</StackPanel> </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> </hc:SimplePanel>
</Grid> </Grid>
<ControlTemplate.Triggers> <ControlTemplate.Triggers>
@@ -5036,7 +5036,7 @@
<TextBlock Text="{Binding ImgPath,ElementName=PART_ImageViewer}" Foreground="White" Margin="10,0,0,0" /> <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" /> <TextBlock Text="{Binding ImgSize,ElementName=PART_ImageViewer,Converter={StaticResource Long2FileSizeConverter}}" Foreground="White" Margin="30,0,0,0" />
</StackPanel> </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> </hc:SimplePanel>
</Grid> </Grid>
<ControlTemplate.Triggers> <ControlTemplate.Triggers>