mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
21 lines
690 B
C#
21 lines
690 B
C#
using System.Windows;
|
|
using System.Windows.Controls;
|
|
|
|
namespace Flow.Launcher.Resources.Controls;
|
|
|
|
public class CardGroupCardStyleSelector : StyleSelector
|
|
{
|
|
public Style FirstStyle { get; set; }
|
|
public Style MiddleStyle { get; set; }
|
|
public Style LastStyle { get; set; }
|
|
|
|
public override Style SelectStyle(object item, DependencyObject container)
|
|
{
|
|
var itemsControl = ItemsControl.ItemsControlFromItemContainer(container);
|
|
var index = itemsControl.ItemContainerGenerator.IndexFromContainer(container);
|
|
|
|
if (index == 0) return FirstStyle;
|
|
if (index == itemsControl.Items.Count - 1) return LastStyle;
|
|
return MiddleStyle;
|
|
}
|
|
}
|