35 lines
2.0 KiB
Markdown
35 lines
2.0 KiB
Markdown
|
|
---
|
||
|
|
source_files:
|
||
|
|
- DataPRO/Modules/Menu/HamburgerMenu/View/HamburgerMenuView.xaml.cs
|
||
|
|
generated_at: "2026-04-17T16:15:25.514898+00:00"
|
||
|
|
model: "zai-org/GLM-5-FP8"
|
||
|
|
schema_version: 1
|
||
|
|
sha256: "6227b274bd720bdb"
|
||
|
|
---
|
||
|
|
|
||
|
|
# View
|
||
|
|
|
||
|
|
### Purpose
|
||
|
|
This module contains the code-behind for the `HamburgerMenuView` WPF UserControl. It provides the UI interaction logic for a hamburger-style menu, specifically handling the click event on the hamburger button to display a context menu retrieved from the view model.
|
||
|
|
|
||
|
|
### Public Interface
|
||
|
|
|
||
|
|
**`HamburgerMenuView` class** - Partial class, implements `IHamburgerMenuView`
|
||
|
|
|
||
|
|
- **`HamburgerMenuView()`** - Default constructor. Calls `InitializeComponent()` to load the XAML.
|
||
|
|
- **`void Hamburger_Click(object sender, System.Windows.RoutedEventArgs e)`** - Private event handler. Retrieves the `IHamburgerMenuViewModel` from `DataContext`, gets the context menu via `GetContextMenu()`, sets the `PlacementTarget` to the sender button, and opens the context menu.
|
||
|
|
|
||
|
|
### Invariants
|
||
|
|
- `DataContext` must be castable to `IHamburgerMenuViewModel` when `Hamburger_Click` is invoked, otherwise an `InvalidCastException` will occur.
|
||
|
|
- The sender in `Hamburger_Click` must be castable to `Button`, otherwise `PlacementTarget` will be set to null.
|
||
|
|
|
||
|
|
### Dependencies
|
||
|
|
- **Depends on**: `DTS.Common.Interface.Menu.HamburgerMenu` (for `IHamburgerMenuView` and `IHamburgerMenuViewModel`)
|
||
|
|
- **Depends on**: `System.Windows.Controls` (for `Button` and UserControl base class)
|
||
|
|
- **XAML file**: `HamburgerMenuView.xaml` (referenced via `InitializeComponent()`)
|
||
|
|
|
||
|
|
### Gotchas
|
||
|
|
- The file contains a large block of commented-out code (approximately 60 lines) related to `GridViewColumnHeader`, `ListView` mouse handling, and `SLICE6TreeViewPopup`. This appears to be dead code from another view that was copied or refactored. It should be removed for clarity.
|
||
|
|
- The namespace is declared as `HamburgerMenu` despite the file path suggesting `HamburgerMenu.View`, with a `// ReSharper disable CheckNamespace` directive suppressing the mismatch.
|
||
|
|
|
||
|
|
---
|