init
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
---
|
||||
source_files:
|
||||
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.GraphList/Classes/VirtualToggleButton.cs
|
||||
generated_at: "2026-04-17T15:59:03.091690+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "b9f03ca53fe295ee"
|
||||
---
|
||||
|
||||
# VirtualToggleButton Documentation
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
`VirtualToggleButton` is a static utility class that provides attached dependency properties to imbue any WPF element with toggle button behavior. It allows arbitrary `DependencyObject` instances (specifically those implementing `IInputElement`) to respond to mouse and keyboard input as if they were `ToggleButton` controls, raising the standard `Checked`, `Unchecked`, and `Indeterminate` routed events. This enables toggle-style interactions on elements that cannot inherit from `ToggleButton` directly, such as `TreeViewItem` or custom controls in the `DTS.Viewer.GraphList` module.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Attached Properties
|
||||
|
||||
#### `IsLockedProperty`
|
||||
```csharp
|
||||
public static readonly DependencyProperty IsLockedProperty
|
||||
```
|
||||
- **Type:** `Nullable<bool>`
|
||||
- **Default Value:** `false`
|
||||
- **Metadata Flags:** `BindsTwoWayByDefault | Journal`
|
||||
- **Description:** Represents the toggle state of the virtual button. When set to `true`, raises `ToggleButton.CheckedEvent`; when `false`, raises `ToggleButton.UncheckedEvent`; when `null`, raises `ToggleButton.IndeterminateEvent`.
|
||||
|
||||
#### `IsThreeStateProperty`
|
||||
```csharp
|
||||
public static readonly DependencyProperty IsThreeStateProperty
|
||||
```
|
||||
- **Type:** `bool`
|
||||
- **Default Value:** `false`
|
||||
- **Description:** Determines whether the control supports three states. When `true`, `IsLocked` can cycle through `null` as a third state.
|
||||
|
||||
#### `IsVirtualToggleButtonProperty`
|
||||
```csharp
|
||||
public static readonly DependencyProperty IsVirtualToggleButtonProperty
|
||||
```
|
||||
- **Type:** `bool`
|
||||
- **Default Value:** `false`
|
||||
- **Description:** When set to `true` on an element implementing `IInputElement`, attaches mouse and keyboard handlers to enable toggle button behavior.
|
||||
|
||||
### Getter/Setter Methods
|
||||
|
||||
```csharp
|
||||
public static Nullable<bool> GetIsLocked(DependencyObject d)
|
||||
public static void SetIsLocked(DependencyObject d, Nullable<bool> value)
|
||||
|
||||
public static bool GetIsThreeState(DependencyObject d)
|
||||
public static void SetIsThreeState(DependencyObject d, bool value)
|
||||
|
||||
public static bool GetIsVirtualToggleButton(DependencyObject d)
|
||||
public static void SetIsVirtualToggleButton(DependencyObject
|
||||
Reference in New Issue
Block a user