Skip to content

Portable Tool for an Ideal Windows Setup

-edit bind for cards

Greedeks464ebd98c6f2
diff --git a/.Source/GTweak/Assets/UserControl/Card.xaml b/.Source/GTweak/Assets/UserControl/Card.xaml
index e75babdc..2b81eb40 100644
--- a/.Source/GTweak/Assets/UserControl/Card.xaml
+++ b/.Source/GTweak/Assets/UserControl/Card.xaml
@@ -6,16 +6,16 @@
xmlns:local="clr-namespace:GTweak.Assets.UserControl"
mc:Ignorable="d"
d:Height="auto" d:Width="auto" SnapsToDevicePixels="True" UseLayoutRounding="True">
- <Grid Width="Auto">
- <Border CornerRadius="10" Height="230" Width="230" HorizontalAlignment="Center" VerticalAlignment="Center" Background="{StaticResource Color_Background_Dark}" Margin="0,-30,0,0">
+ <Viewbox Width="230" Height="230">
+ <Border CornerRadius="10" Height="230" Width="230" HorizontalAlignment="Center" VerticalAlignment="Center" Background="{StaticResource Color_Background_Dark}">
<StackPanel Orientation="Vertical" >
<Grid Width="Auto" Height="Auto" Margin="0,15,0,0" HorizontalAlignment="Center" VerticalAlignment="Center">
- <Image x:Name="CardImage" Height="60" Width="60" Stretch="Uniform"/>
+ <Image x:Name="CardImage" Height="60" Width="60" Stretch="Uniform" Source="{Binding ImageSource, RelativeSource={RelativeSource AncestorType=local:Card}}"/>
</Grid>
<TextBlock x:Name="CardTitle" Style="{StaticResource Text}" Margin="0,5,0,0" FontSize="11pt" Width="Auto" Height="Auto" HorizontalAlignment="Center" VerticalAlignment="Center" Text="Title"/>
<TextBlock x:Name="CardText" Style="{StaticResource Text}" Foreground="{StaticResource Color_TetBlock_Inactivity}" Margin="0,10,0,0" FontSize="11pt" Width="218" Height="70" HorizontalAlignment="Center" TextAlignment="Center" Text="Text"/>
<Button x:Name="CardButton" Content="Content" Style="{StaticResource BtnDefault}" Width="150" Height="30" Margin="0,10,0,0" Cursor="Hand" PreviewMouseLeftButtonUp="CardButton_PreviewMouseLeftButtonUp"/>
</StackPanel>
</Border>
- </Grid>
+ </Viewbox>
</UserControl>
diff --git a/.Source/GTweak/Assets/UserControl/Card.xaml.cs b/.Source/GTweak/Assets/UserControl/Card.xaml.cs
index 507e5c61..3b695c12 100644
--- a/.Source/GTweak/Assets/UserControl/Card.xaml.cs
+++ b/.Source/GTweak/Assets/UserControl/Card.xaml.cs
@@ -13,7 +13,7 @@ namespace GTweak.Assets.UserControl
/// </summary>
internal event EventHandler ClickButton;
- internal ImageSource ImageSource { get => CardImage.Source; set { CardImage.Source = value; } }
+ internal ImageSource ImageSource { set => SetValue(ImageSourceProperty, value); }
internal DynamicResourceExtension Title { set => CardTitle.SetResourceReference(TextBlock.TextProperty, new DynamicResourceExtensionConverter().ConvertToString(value.ResourceKey)); }
internal DynamicResourceExtension Description { set => CardText.SetResourceReference(TextBlock.TextProperty, new DynamicResourceExtensionConverter().ConvertToString(value.ResourceKey)); }
internal DynamicResourceExtension BtnContent { set => CardButton.SetResourceReference(ContentProperty, new DynamicResourceExtensionConverter().ConvertToString(value.ResourceKey)); }
@@ -22,7 +22,10 @@ namespace GTweak.Assets.UserControl
DependencyProperty.Register("DescriptionBlock", typeof(string), typeof(TextBlock), new PropertyMetadata("", (s, e) => ((TextBlock)s).Text = (string)e.NewValue));
internal new static readonly DependencyProperty ContentProperty =
- DependencyProperty.Register("ContentButton", typeof(string), typeof(Button), new PropertyMetadata("", (s, e) => ((Button)s).Content = (string)e.NewValue));
+ DependencyProperty.Register("BtnContent", typeof(string), typeof(Button), new PropertyMetadata("", (s, e) => ((Button)s).Content = (string)e.NewValue));
+
+ internal static readonly DependencyProperty ImageSourceProperty =
+ DependencyProperty.Register("ImageSource", typeof(ImageSource), typeof(Card), new PropertyMetadata(default(ImageSource)));
public Card()
{
diff --git a/.Source/GTweak/View/MoreView.xaml b/.Source/GTweak/View/MoreView.xaml
index 75964121..422faa18 100644
--- a/.Source/GTweak/View/MoreView.xaml
+++ b/.Source/GTweak/View/MoreView.xaml
@@ -18,7 +18,7 @@
<TextBlock Width="Auto" Height="auto" FontFamily="{StaticResource Jura}" FontSize="13pt" Foreground="{StaticResource Color_TetBlock_Inactivity}" HorizontalAlignment="Center" VerticalAlignment="Top" KeyboardNavigation.IsTabStop="False" Margin="0,10,0,0"><Run Text="{DynamicResource text0_more}"/><Run Text=" "/><Run Text="{DynamicResource text1_more}" Foreground="{StaticResource Color_Accent}"/><Run Text=" "/><Run Text="{DynamicResource text2_more}"/></TextBlock>
</Grid>
- <Grid Grid.Row="1" Margin="0,20,0,0">
+ <Grid Grid.Row="1">
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
@@ -45,7 +45,7 @@
</Grid>
</Grid>
- <Grid Grid.Row="1" Margin="0,10,0,0">
+ <Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>