Skip to content

Commit

Permalink
Merge pull request #115 from iNKORE-NET/new-gallery
Browse files Browse the repository at this point in the history
New gallery
  • Loading branch information
NotYoojun authored Dec 22, 2024
2 parents b7e7749 + 68bccd8 commit 92f472f
Show file tree
Hide file tree
Showing 209 changed files with 1,503 additions and 740 deletions.
2 changes: 1 addition & 1 deletion samples/SettingsNavigationTest/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Apps}"/>
</ui:SettingsCard.HeaderIcon>
</ui:SettingsCard>
<ui:SettingsCard Header="Browser Search Engine"
<ui:SettingsCard Header="Browser Search Engine" IsEnabled="False"
Description="Choose the search engine you like.">
<ui:SettingsCard.HeaderIcon>
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.CloudSearch}"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,31 +161,31 @@
<VisualState x:Name="Disabled">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_ActionIconPresenter"
Storyboard.TargetProperty="Foreground">
Storyboard.TargetProperty="(ui:ContentPresenterEx.Foreground)">
<DiscreteObjectKeyFrame KeyTime="0"
Value="{DynamicResource SettingsCardForegroundDisabled}" />
</ObjectAnimationUsingKeyFrames>

<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_HeaderIconPresenter"
Storyboard.TargetProperty="Foreground">
Storyboard.TargetProperty="(ui:ContentPresenterEx.Foreground)">
<DiscreteObjectKeyFrame KeyTime="0"
Value="{DynamicResource SettingsCardForegroundDisabled}" />
</ObjectAnimationUsingKeyFrames>

<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_HeaderPresenter"
Storyboard.TargetProperty="Foreground">
Storyboard.TargetProperty="(ui:ContentPresenterEx.Foreground)">
<DiscreteObjectKeyFrame KeyTime="0"
Value="{DynamicResource SettingsCardForegroundDisabled}" />
</ObjectAnimationUsingKeyFrames>

<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_DescriptionPresenter"
Storyboard.TargetProperty="Foreground">
Storyboard.TargetProperty="(ui:ContentPresenterEx.Foreground)">
<DiscreteObjectKeyFrame KeyTime="0"
Value="{DynamicResource SettingsCardForegroundDisabled}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
<!--<VisualState.Setters>
-->
https://stackoverflow.com/questions/25566944/wpf-theme-error-cannot-resolve-all-property-references-in-the-property-path -->
<!-- DisabledVisual Should be handled by the control, not the animated icon. -->
<!--
<Setter Target="PART_RootGrid.(muxc:AnimatedIcon.State)" Value="Normal" />
Expand Down Expand Up @@ -225,7 +225,11 @@
</ObjectAnimationUsingKeyFrames>-->

<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HeaderPanel" Storyboard.TargetProperty="Margin">
<DiscreteObjectKeyFrame KeyTime="0" Value="0" />
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<Thickness>0,0,0,8</Thickness>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
Expand Down Expand Up @@ -254,7 +258,11 @@
</ObjectAnimationUsingKeyFrames>-->

<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HeaderPanel" Storyboard.TargetProperty="Margin">
<DiscreteObjectKeyFrame KeyTime="0" Value="0" />
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<Thickness>0,0,0,8</Thickness>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ protected override void OnNavigatedTo(NavigationEventArgs e)
menuItem.IsSelected = true;
NavigationRootPage.Current.NavigationView.Header = string.Empty;

Items = ControlInfoDataSource.Instance.Groups.SelectMany(g => g.Items).OrderBy(i => i.Title).ToList();
Items = ControlInfoDataSource.Instance.AllGroups.SelectMany(g => g.Items).OrderBy(i => i.Title).ToList();
DataContext = Items;
}
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 12 additions & 1 deletion source/iNKORE.UI.WPF.Modern.Gallery/Common/Extensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Windows;
using System.Text.Json;
using System.Windows;
using System.Windows.Media;

namespace iNKORE.UI.WPF.Modern.Gallery
Expand All @@ -23,5 +24,15 @@ public static string ToHEX(this Color color)
{
return $"#{color.R:X2}{color.G:X2}{color.B:X2}";
}

public static JsonElement? TryGetProperty(this JsonElement element, string propertyName)
{
if (element.TryGetProperty(propertyName, out var value))
{
return value;
}

return null;
}
}
}
10 changes: 5 additions & 5 deletions source/iNKORE.UI.WPF.Modern.Gallery/Common/ImageLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,25 @@ namespace iNKORE.UI.WPF.Modern.Gallery.Common
{
public class ImageLoader
{
public static string GetSource(DependencyObject obj)
public static ControlInfoDataItem GetSource(DependencyObject obj)
{
return (string)obj.GetValue(SourceProperty);
return (ControlInfoDataItem)obj.GetValue(SourceProperty);
}

public static void SetSource(DependencyObject obj, string value)
public static void SetSource(DependencyObject obj, ControlInfoDataItem value)
{
obj.SetValue(SourceProperty, value);
}

// Using a DependencyProperty as the backing store for Path. This enables animation, styling, binding, etc...
public static readonly DependencyProperty SourceProperty =
DependencyProperty.RegisterAttached("Source", typeof(string), typeof(ImageLoader), new PropertyMetadata(string.Empty, OnPropertyChanged));
DependencyProperty.RegisterAttached("Source", typeof(ControlInfoDataItem), typeof(ImageLoader), new PropertyMetadata(null, OnPropertyChanged));

private async static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (d is Image image)
{
var item = await ControlInfoDataSource.Instance.GetItemAsync(e.NewValue?.ToString());
var item = e.NewValue as ControlInfoDataItem;
if (item?.ImagePath != null)
{
Uri imageUri = new Uri(item.ImagePath, UriKind.Relative);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties":
{
Expand Down Expand Up @@ -118,7 +117,11 @@
"description": "Documentation link url"
}
},
"required": [ "Title", "Uri" ]
"required":
[
"Title",
"Uri"
]
},
"description": "Add a link to the doc in the Documentation dropdown on the detail page of this control"
},
Expand All @@ -133,11 +136,29 @@
"description": "Array of names of the related control"
}
},
"required": [ "UniqueId", "Title", "Subtitle", "ImagePath", "ImageIconPath", "Description", "Content" ]
"required":
[
"UniqueId",
"Title",
"Subtitle",
"ImagePath",
"ImageIconPath",
"Description",
"Content"
]
}
}
},
"required": [ "UniqueId", "Title", "Subtitle", "ImagePath", "ImageIconPath", "Description", "Items" ]
"required":
[
"UniqueId",
"Title",
"Subtitle",
"ImagePath",
"ImageIconPath",
"Description",
"Items"
]
}
}
},
Expand Down
Loading

0 comments on commit 92f472f

Please sign in to comment.