This commit is contained in:
Meik
2025-11-11 11:03:42 +01:00
commit dc3e8a2e4c
582 changed files with 191465 additions and 0 deletions

View File

@@ -0,0 +1,103 @@
using F4SD_AdaptableIcon.Enums;
using F4SDicons.Models;
using FasdDesktopUi.Basics.UserControls.AdaptableIcon;
using MaterialIcons;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using static FasdDesktopUi.Basics.UserControls.AdaptableIcon.cIconPainter;
namespace F4SDicons.User_Controls
{
public partial class IconGrid : UserControl
{
public List<cAdvancedIconInformation> IconInformation
{
get { return (List<cAdvancedIconInformation>)GetValue(IconInformationProperty); }
set { SetValue(IconInformationProperty, value); }
}
// Using a DependencyProperty as the backing store for IconInformation. This enables animation, styling, binding, etc...
public static readonly DependencyProperty IconInformationProperty =
DependencyProperty.Register("IconInformation", typeof(List<cAdvancedIconInformation>), typeof(IconGrid), new PropertyMetadata(null));
public IconGrid()
{
InitializeComponent();
}
#region Klick Event
#region Event
public event RoutedEventHandler IconSelected
{
add { AddHandler(IconCollectionUserControl.IconSelectedEvent, value); }
remove { RemoveHandler(IconCollectionUserControl.IconSelectedEvent, value); }
}
#endregion
#region Klick
private void adaptableIcon_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
MaterialIconWasClicked(sender);
}
private void adaptableIcon_TouchDown(object sender, TouchEventArgs e)
{
MaterialIconWasClicked(sender);
}
#endregion
#region On Klick
private void MaterialIconWasClicked(object sender)
{
if (!(sender is FrameworkElement frameworkElement))
return;
enumIconTypes? iconType = null;
if (Enum.TryParse(frameworkElement.Tag.ToString(), out MaterialIconType _))
iconType = enumIconTypes.material;
else if (Enum.TryParse(frameworkElement.Tag.ToString(), out enumInternIcons _))
iconType = enumIconTypes.intern;
if (iconType is null)
return;
RoutedEventArgsIconInfo eventArgs = new RoutedEventArgsIconInfo(IconCollectionUserControl.IconSelectedEvent) { IconName = frameworkElement.Tag.ToString(), IconType = iconType.Value };
RaiseEvent(eventArgs);
}
#endregion
#endregion
}
}