mirror of
https://github.com/AtomUI/AtomUI.git
synced 2026-10-28 14:20:47 +08:00
Add DataGridFilterDescription
This commit is contained in:
@@ -20,7 +20,6 @@ namespace AtomUI.Controls;
|
||||
public abstract partial class DataGridColumn : IDataGridColumnGroupItem
|
||||
{
|
||||
#region 常量定义
|
||||
|
||||
internal const bool DefaultIsReadOnly = false;
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
|
||||
// All other rights reserved.
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using AtomUI.Controls.Utils;
|
||||
using AtomUI.Utils;
|
||||
@@ -76,6 +78,7 @@ public abstract partial class DataGridColumn : AvaloniaObject
|
||||
public static readonly StyledProperty<VerticalAlignment> VerticalAlignmentProperty =
|
||||
Layoutable.VerticalAlignmentProperty.AddOwner<DataGridColumn>();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether or not this column is visible.
|
||||
/// </summary>
|
||||
@@ -374,11 +377,7 @@ public abstract partial class DataGridColumn : AvaloniaObject
|
||||
/// <summary>
|
||||
/// The binding that will be used to get or set cell content for the clipboard.
|
||||
/// </summary>
|
||||
public virtual IBinding? ClipboardContentBinding
|
||||
{
|
||||
get => _clipboardContentBinding;
|
||||
set => _clipboardContentBinding = value;
|
||||
}
|
||||
public virtual IBinding? ClipboardContentBinding { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Holds the name of the member to use for sorting, if not using the default.
|
||||
@@ -393,7 +392,27 @@ public abstract partial class DataGridColumn : AvaloniaObject
|
||||
/// <summary>
|
||||
/// Holds a Comparer to use for sorting, if not using the default.
|
||||
/// </summary>
|
||||
public System.Collections.IComparer? CustomSortComparer { get; set; }
|
||||
public IComparer? CustomSortComparer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Filter menu config
|
||||
/// </summary>
|
||||
public ObservableCollection<DataGridFilterItem> Filters { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Custom filter, the first parameter is the filter condition, the second parameter is the data record
|
||||
/// </summary>
|
||||
public Func<object, object, bool> OnFilter { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether multiple filters can be selected
|
||||
/// </summary>
|
||||
public DataGridFilterMode FilterMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether to trigger filter when the filter menu closes
|
||||
/// </summary>
|
||||
public bool FilterOnClose { get; set; }
|
||||
|
||||
public virtual bool IsReadOnly
|
||||
{
|
||||
@@ -419,17 +438,9 @@ public abstract partial class DataGridColumn : AvaloniaObject
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsAutoGenerated
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
public bool IsAutoGenerated { get; internal set; }
|
||||
|
||||
public bool IsFrozen
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
public bool IsFrozen { get; internal set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -468,6 +479,7 @@ public abstract partial class DataGridColumn : AvaloniaObject
|
||||
_displayIndexWithFiller = -1;
|
||||
IsInitialDesiredWidthDetermined = false;
|
||||
InheritsWidth = true;
|
||||
OnFilter = (value, record) => true;
|
||||
}
|
||||
|
||||
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
|
||||
|
||||
@@ -112,7 +112,7 @@ internal class DataGridDataConnection
|
||||
{
|
||||
if (dataType != null)
|
||||
{
|
||||
Type type = TypeHelper.GetNonNullableType(dataType); // no-opt if dataType isn't nullable
|
||||
var type = dataType.GetNonNullableType(); // no-opt if dataType isn't nullable
|
||||
return type.IsPrimitive || type == typeof(string) || type == typeof(DateTime) || type == typeof(Decimal);
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -2,5 +2,8 @@ namespace AtomUI.Controls.Data;
|
||||
|
||||
public class DataGridFilterDescription
|
||||
{
|
||||
|
||||
public bool IsEnabled { get; set; }
|
||||
public int ColumnIndex { get; set; }
|
||||
public List<object>? FilterConditions { get; set; }
|
||||
public Func<object, object, bool>? OnFilter { get; set; }
|
||||
}
|
||||
@@ -338,8 +338,8 @@ public class DataGridComparerSortDescription : DataGridSortDescription
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
public override DataGridSortDescription SwitchSortDirection()
|
||||
{
|
||||
var newDirection = _direction == ListSortDirection.Ascending ? ListSortDirection.Descending : ListSortDirection.Ascending;
|
||||
|
||||
Reference in New Issue
Block a user