346 lines
9.6 KiB
Markdown
346 lines
9.6 KiB
Markdown
# 常用 API 声明参考
|
||
|
||
来源:MAX.Common.WPF,2026-10-27 工作区源码快照。
|
||
|
||
按下方主题或文件名搜索。仅摘录选定文件的 public / protected 声明;省略方法体、初始化表达式与 XML 注释。这是定位参考,不是可直接编译的 C#,不保证包含嵌套类型的完整可见性上下文。行为说明见 SKILL.md;目标包版本不同时以实际包为准。
|
||
|
||
目录:控件与布局、枚举、视图与绑定、线程与防抖、虚拟化与转换器
|
||
|
||
## 控件与布局
|
||
|
||
### Controls/NumberBox.cs
|
||
|
||
命名空间:`MAX.Common.WPF.Controls`
|
||
|
||
```csharp
|
||
public class NumberBox : TextBox
|
||
public NumberBox()
|
||
protected Button UpButton
|
||
protected Button DownButton
|
||
public override void OnApplyTemplate()
|
||
protected virtual void DataObjectPasting(object sender, DataObjectPastingEventArgs e)
|
||
protected virtual void OnValueChanged(PayloadRoutedEventArgs<double> e)
|
||
public event EventHandler<PayloadRoutedEventArgs<double>> ValueChanged
|
||
public double Value
|
||
public double Maximum
|
||
public double Minimum
|
||
public double Increment
|
||
public int? DecimalPlaces
|
||
public string ValueFormat
|
||
public bool ShowUpDownButton
|
||
```
|
||
|
||
### Controls/TitleContent.cs
|
||
|
||
命名空间:`MAX.Common.WPF.Controls`
|
||
|
||
```csharp
|
||
public class TitleContent : ContentControl
|
||
public object Title
|
||
public double TitleWidth
|
||
public HorizontalAlignment TitleHorizontalAlignment
|
||
public VerticalAlignment TitleVerticalAlignment
|
||
public TitlePlacementType Placement
|
||
public Thickness TopTitlePadding
|
||
public Thickness LeftTitlePadding
|
||
public TitleContent()
|
||
```
|
||
|
||
### Controls/BoolContent.cs
|
||
|
||
命名空间:`MAX.Common.WPF.Controls`
|
||
|
||
```csharp
|
||
public class BoolContent : Control
|
||
public object TrueContent
|
||
public object FalseContent
|
||
public bool Bool
|
||
public CornerRadius CornerRadius
|
||
```
|
||
|
||
### Controls/SpacingStackPanel.cs
|
||
|
||
命名空间:`MAX.Common.WPF.Controls`
|
||
|
||
```csharp
|
||
public class SpacingStackPanel : Panel
|
||
public Orientation Orientation
|
||
public bool ChildWrapping
|
||
public double HorizontalSpacing
|
||
public double VerticalSpacing
|
||
public double ItemWidth
|
||
public double ItemHeight
|
||
public HorizontalAlignment? ItemHorizontalAlignment
|
||
public VerticalAlignment? ItemVerticalAlignment
|
||
```
|
||
|
||
### Controls/SpacingUniformGrid.cs
|
||
|
||
命名空间:`MAX.Common.WPF.Controls`
|
||
|
||
```csharp
|
||
public class SpacingUniformGrid : Panel
|
||
public int Rows
|
||
public int Columns
|
||
public double RowSpacing
|
||
public double ColumnSpacing
|
||
```
|
||
|
||
### Controls/AutoColumnsUniformGrid.cs
|
||
|
||
命名空间:`MAX.Common.WPF.Controls`
|
||
|
||
```csharp
|
||
public class AutoColumnsUniformGrid : UniformGrid
|
||
public double CellMinWidth
|
||
public int MinColumns
|
||
public int MaxColumns
|
||
```
|
||
|
||
### Controls/ButtonPopup.cs
|
||
|
||
命名空间:`MAX.Common.WPF.Controls`
|
||
|
||
```csharp
|
||
public class ButtonPopup : CustomPopup
|
||
public ButtonBase SourceButton
|
||
public ICommand OnClickOpenCommand
|
||
public ButtonPopup() : base()
|
||
```
|
||
|
||
### Controls/NotifyIcon.cs
|
||
|
||
命名空间:`MAX.Common.WPF.Controls`
|
||
|
||
```csharp
|
||
public class NotifyIcon : FrameworkElement, IDisposable
|
||
public static string WindowClassNamePrefix
|
||
public NotifyIcon()
|
||
public void Initialize()
|
||
public static void ShowBalloonTip(string title, string content, NotifyIconInfoType infoType, string token)
|
||
public void ShowBalloonTip(string title, string content, NotifyIconInfoType infoType)
|
||
public void Dispose()
|
||
public void CloseContextControl()
|
||
public string Token
|
||
public string Text
|
||
public ImageSource Icon
|
||
public object ContextContent
|
||
public TimeSpan BlinkInterval
|
||
public bool IsBlink
|
||
public event RoutedEventHandler Click
|
||
public event RoutedEventHandler MouseDoubleClick
|
||
```
|
||
|
||
## 枚举、视图与绑定
|
||
|
||
### MarkupExtensions/EnumBindingMarkupExtension.cs
|
||
|
||
命名空间:`MAX.Common.WPF.MarkupExtensions`
|
||
|
||
```csharp
|
||
public class EnumBindingMarkupExtension : MarkupExtension
|
||
public IValueConverter Converter
|
||
public object ConverterParameter
|
||
public Type EnumType
|
||
public bool AllowNull
|
||
public object NullDisplay
|
||
public bool DisplayNullLast
|
||
public EnumBindingMarkupExtension()
|
||
public EnumBindingMarkupExtension(Type enumType)
|
||
public override object ProvideValue(IServiceProvider serviceProvider)
|
||
public class EnumBindingItem
|
||
public object Display
|
||
public object Value
|
||
public override string ToString()
|
||
public override bool Equals(object obj)
|
||
public override int GetHashCode()
|
||
```
|
||
|
||
### Extensions/EnumBindingExtension.cs
|
||
|
||
命名空间:`MAX.Common.WPF.Extensions`
|
||
|
||
```csharp
|
||
public static class EnumBindingExtension
|
||
public static void SetSelectedEnum(DependencyObject element, object value)
|
||
public static object GetSelectedEnum(DependencyObject element)
|
||
```
|
||
|
||
### Extensions/ViewModelExtension.cs
|
||
|
||
命名空间:`MAX.Common.WPF.Extensions`
|
||
|
||
```csharp
|
||
public class ViewModelExtension
|
||
public static bool GetAutoAssignViewModel(DependencyObject obj)
|
||
public static void SetAutoAssignViewModel(DependencyObject obj, bool value)
|
||
```
|
||
|
||
### Extensions/BindingProxies.cs
|
||
|
||
命名空间:`MAX.Common.WPF.Extensions`
|
||
|
||
```csharp
|
||
public abstract class BindingProxyBase<T> : Freezable
|
||
public T Data
|
||
public class BindingProxy : BindingProxyBase<object>
|
||
public class BooleanProxy : BindingProxyBase<bool>
|
||
```
|
||
|
||
### Extensions/TextBoxExtension.cs
|
||
|
||
命名空间:`MAX.Common.WPF.Extensions`
|
||
|
||
```csharp
|
||
public static class TextBoxExtension
|
||
public static bool GetHandleEnterToNextFocus(DependencyObject obj)
|
||
public static void SetHandleEnterToNextFocus(DependencyObject obj, bool value)
|
||
public static bool GetHandleEscapeToUndoText(DependencyObject obj)
|
||
public static void SetHandleEscapeToUndoText(DependencyObject obj, bool value)
|
||
```
|
||
|
||
### Extensions/ButtonExtension.cs
|
||
|
||
命名空间:`MAX.Common.WPF.Extensions`
|
||
|
||
```csharp
|
||
public static class ButtonExtension
|
||
public static bool GetIsChecked(DependencyObject obj)
|
||
public static void SetIsChecked(DependencyObject obj, bool value)
|
||
public static bool GetSetPreviewClick(DependencyObject obj)
|
||
public static void SetSetPreviewClick(DependencyObject obj, bool value)
|
||
```
|
||
|
||
## 线程与防抖
|
||
|
||
### Helpers/DispatcherHelper.cs
|
||
|
||
命名空间:`MAX.Common.WPF.Helpers`
|
||
|
||
```csharp
|
||
public static class DispatcherHelper
|
||
public static void RunInDispatcher(Dispatcher dispatcher, Action action)
|
||
public static Dispatcher AppDispatcher
|
||
public static void RunInDispatcher(Action action)
|
||
```
|
||
|
||
### Utilities/DebounceDispatcher.cs
|
||
|
||
命名空间:`MAX.Common.WPF.Utilities`
|
||
|
||
```csharp
|
||
public class DebounceDispatcher
|
||
public void Debounce(TimeSpan delay, Action action)
|
||
```
|
||
|
||
### Utilities/AsyncDebouncer.cs
|
||
|
||
命名空间:`MAX.Common.WPF.Utilities`
|
||
|
||
```csharp
|
||
public class AsyncDebouncer(int delayMilliseconds = 300)
|
||
public void Invoke(Func<Task> action)
|
||
```
|
||
|
||
### Utilities/Timers/TimerControllerBase.cs
|
||
|
||
命名空间:`MAX.Common.WPF.Utilities.Timers`
|
||
|
||
```csharp
|
||
public abstract class TimerControllerBase : IDisposable
|
||
public abstract void Dispose()
|
||
```
|
||
|
||
### Utilities/Timers/DispatcherTimerController.cs
|
||
|
||
命名空间:`MAX.Common.WPF.Utilities.Timers`
|
||
|
||
```csharp
|
||
public class DispatcherTimerController : TimerControllerBase
|
||
public event TypedEventHandler<DispatcherTimerController, Exception> ExceptionOccurred
|
||
public DispatcherTimerController(DispatcherPriority dispatcherPriority, TimeSpan interval, Func<Task> actionAsync, Dispatcher dispatcher = null) : this(dispatcherPriority, interval, dispatcher)
|
||
public DispatcherTimerController(DispatcherPriority dispatcherPriority, TimeSpan interval, Action action, Dispatcher dispatcher = null) : this(dispatcherPriority, interval, dispatcher)
|
||
public virtual void OnException(Exception exception)
|
||
public virtual void Start()
|
||
public virtual void Stop()
|
||
public override void Dispose()
|
||
```
|
||
|
||
## 虚拟化与转换器
|
||
|
||
### Virtualization/VirtualizingItemsControl.cs
|
||
|
||
命名空间:`MAX.Common.WPF.Virtualization`
|
||
|
||
```csharp
|
||
public class VirtualizingItemsControl : ItemsControl
|
||
public VirtualizingItemsControl()
|
||
```
|
||
|
||
### Virtualization/VirtualizingWrapPanel.cs
|
||
|
||
命名空间:`MAX.Common.WPF.Virtualization`
|
||
|
||
```csharp
|
||
public class VirtualizingWrapPanel : VirtualizingPanelBase
|
||
public Orientation Orientation
|
||
public Size ItemSize
|
||
public bool AllowDifferentSizedItems
|
||
public IItemSizeProvider? ItemSizeProvider
|
||
public ItemAlignment ItemAlignment
|
||
public SpacingMode SpacingMode
|
||
public bool StretchItems
|
||
public bool IsGridLayoutEnabled
|
||
public void ClearItemSizeCache()
|
||
```
|
||
|
||
### Virtualization/IItemSizeProvider.cs
|
||
|
||
命名空间:`MAX.Common.WPF.Virtualization`
|
||
|
||
```csharp
|
||
public interface IItemSizeProvider
|
||
```
|
||
|
||
### Converters/Boolean2VisibilityConverter.cs
|
||
|
||
命名空间:`MAX.Common.WPF.Converters`
|
||
|
||
```csharp
|
||
public class Boolean2VisibilityConverter : IValueConverter
|
||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||
```
|
||
|
||
### Converters/EnumDisplayConverter.cs
|
||
|
||
命名空间:`MAX.Common.WPF.Converters`
|
||
|
||
```csharp
|
||
public class EnumDisplayConverter : IValueConverter
|
||
public static EnumDisplayManagerBase EnumDisplayManager
|
||
public EnumDisplayManagerBase SelfEnumDisplayManager
|
||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||
```
|
||
|
||
### Converters/FormatConverter.cs
|
||
|
||
命名空间:`MAX.Common.WPF.Converters`
|
||
|
||
```csharp
|
||
public class FormatConverter : IMultiValueConverter
|
||
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
|
||
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
|
||
```
|
||
|
||
### Converters/StringJoinConverter.cs
|
||
|
||
命名空间:`MAX.Common.WPF.Converters`
|
||
|
||
```csharp
|
||
public class StringJoinConverter : IValueConverter
|
||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||
```
|