58 lines
1.8 KiB
C#
58 lines
1.8 KiB
C#
using System.Windows;
|
|
using System.Windows.Controls;
|
|
|
|
namespace CopaData.FileInspector.GUI.TilingPanels.Controls
|
|
{
|
|
/// <summary>
|
|
/// Used to force-update columns into rows when orientation is vertical
|
|
/// </summary>
|
|
public static class TilingGridAttachment
|
|
{
|
|
#region AlphaRow
|
|
public static readonly DependencyProperty AlphaRowProperty =
|
|
DependencyProperty.RegisterAttached(
|
|
"AlphaRow",
|
|
typeof(int),
|
|
typeof(TilingGridAttachment),
|
|
new PropertyMetadata(0, OnAlphaRowChanged));
|
|
|
|
public static int GetAlphaRow(DependencyObject obj)
|
|
=> (int)obj.GetValue(AlphaRowProperty);
|
|
public static void SetAlphaRow(DependencyObject obj, int value)
|
|
=> obj.SetValue(AlphaRowProperty, value);
|
|
|
|
private static void OnAlphaRowChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
|
{
|
|
if (d is ContentPresenter presenter)
|
|
{
|
|
Grid.SetRow(presenter, (int)e.NewValue);
|
|
Grid.SetColumn(presenter, 0); // Always Column 0 for vertical split
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region BetaRow
|
|
public static readonly DependencyProperty BetaRowProperty =
|
|
DependencyProperty.RegisterAttached(
|
|
"BetaRow",
|
|
typeof(int),
|
|
typeof(TilingGridAttachment),
|
|
new PropertyMetadata(0, OnBetaRowChanged));
|
|
|
|
public static int GetBetaRow(DependencyObject obj)
|
|
=> (int)obj.GetValue(BetaRowProperty);
|
|
public static void SetBetaRow(DependencyObject obj, int value)
|
|
=> obj.SetValue(BetaRowProperty, value);
|
|
|
|
private static void OnBetaRowChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
|
{
|
|
if (d is ContentPresenter presenter)
|
|
{
|
|
Grid.SetRow(presenter, (int)e.NewValue);
|
|
Grid.SetColumn(presenter, 0); // Always Column 0 for vertical split
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
}
|