Skip to content

Commit

Permalink
chore: update ImageBrowser style.
Browse files Browse the repository at this point in the history
  • Loading branch information
NaBian committed Jan 20, 2023
1 parent d0c14de commit b5dfc48
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 28 deletions.
2 changes: 1 addition & 1 deletion src/Net_40/HandyControl_Net_40/Themes/Styles/Window.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,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" 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>
<ControlTemplate.Triggers>
Expand Down
2 changes: 1 addition & 1 deletion src/Net_40/HandyControl_Net_40/Themes/Theme.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5037,7 +5037,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" 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>
<ControlTemplate.Triggers>
Expand Down
25 changes: 1 addition & 24 deletions src/Shared/HandyControl_Shared/Controls/Image/ImageViewer.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Windows;
using System.Windows.Controls;
Expand Down Expand Up @@ -952,29 +951,7 @@ private void OnImageSourceChanged()

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)
Expand Down
2 changes: 1 addition & 1 deletion src/Shared/HandyControl_Shared/Themes/Styles/Window.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion src/Shared/HandyControl_Shared/Themes/Theme.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit b5dfc48

Please sign in to comment.