47 lines
2.1 KiB
Markdown
47 lines
2.1 KiB
Markdown
|
|
---
|
||
|
|
source_files:
|
||
|
|
- Common/DTS.CommonCore/Behaviors/StringMetaDataAttr.cs
|
||
|
|
- Common/DTS.CommonCore/Behaviors/TrimTextBoxBehavior.cs
|
||
|
|
- Common/DTS.CommonCore/Behaviors/InteractivityTemplate.cs
|
||
|
|
- Common/DTS.CommonCore/Behaviors/TextBoxPasteBehavior.cs
|
||
|
|
- Common/DTS.CommonCore/Behaviors/MultiSelectionBehavior.cs
|
||
|
|
generated_at: "2026-04-17T15:35:45.848177+00:00"
|
||
|
|
model: "zai-org/GLM-5-FP8"
|
||
|
|
schema_version: 1
|
||
|
|
sha256: "96d4dc839b72e47c"
|
||
|
|
---
|
||
|
|
|
||
|
|
# Documentation: DTS.Common.Behaviors Namespace
|
||
|
|
|
||
|
|
## 1. Purpose
|
||
|
|
|
||
|
|
This module provides a collection of WPF behaviors and utilities for the DTS CommonCore framework. It enables declarative UI interactions through attached properties and `Behavior<T>` implementations, including text trimming on focus loss, multi-selection synchronization for `ListBox` controls, custom paste command handling, and a mechanism for attaching behaviors/triggers via data templates. It also provides a reflection-based attribute system for storing string metadata on enum values and objects.
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 2. Public Interface
|
||
|
|
|
||
|
|
### StringMetaDataAttr
|
||
|
|
|
||
|
|
**Signature:** `public class StringMetaDataAttr : Attribute`
|
||
|
|
|
||
|
|
A custom attribute for storing string metadata on objects or enum members.
|
||
|
|
|
||
|
|
| Member | Signature | Description |
|
||
|
|
|--------|-----------|-------------|
|
||
|
|
| `MetaData` | `public string MetaData { get; }` | Read-only property returning the stored metadata string. |
|
||
|
|
| `GetStringMetaData` | `public static string GetStringMetaData(object o)` | Retrieves the `MetaData` value from a `StringMetaDataAttr` applied to the object's member (typically an enum value). Returns `null` if no attribute is found or if the object is null. |
|
||
|
|
|
||
|
|
**Constructor:** `internal StringMetaDataAttr(string attr)` — Internal constructor; attributes must be applied at compile time.
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### TrimTextBoxBehavior
|
||
|
|
|
||
|
|
**Signature:** `public class TrimTextBoxBehavior : Behavior<TextBox>`
|
||
|
|
|
||
|
|
A behavior that trims whitespace from a `TextBox` when it loses focus and updates the binding source.
|
||
|
|
|
||
|
|
| Member | Signature | Description |
|
||
|
|
|--------|-----------|-------------|
|
||
|
|
| `OnAttached` | `protected override void OnAttached()` | Subscribes to `AssociatedObject
|