MaterialDesignInXAML / MaterialDesignInXAML/MaterialDesignInXamlToolkit

[WIP] Draggable Dialog

Open
#1,196 4 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
C#
Stars
16.3k
Forks
3.5k
Avg merge
1d 22h
Merged PRs (30d)
8

Description

As I know this is not part of Material Design spec.
But if you like to implement it in web, you have easy possibilities to do this with either [React](https://material-ui.com/demos/dialogs/#draggable-dialog) or [Angular](https://stackoverflow.com/a/49706221/3924697).

For phones I wouldn't like that feature, as you don't have any space to drag the dialog around, but for desktop applications or even on tablets this feature with a wider screens, makes sense, if you maybe like to see what was behind the dialog and it is somehow also Desktop-Application default/expected behavior for dialogs.

## Current implementations
There are two styles, which can be applied to the dialog host.
1. (default) - this style is based on a `Popup` (`PopupEx`) for the dialog.
2. `MaterialDesignEmbeddedDialogHost` - this style is based on `Grid` for the dialog.

## Current behavior
The current behavior is, ...
- that a `Card` is set as the `Grid` or `Popup` content.
- that the dialog will be shown centered to the dialog host.
- that the content (`DialogHost.DialogContent`, `DialogHost.DialogContentTemplate` etc.) is shown in the Card content.
- that while resizing/dragging the dialog remains centered.

## TBD
### default
- [ ] As implemented as a popup the drag could be done anywhere on the screen and is not limited to the dialog host. Should this be allowed or should it be limited?
- [ ] Where should the dialog move on resize or drag of the host window? I think `PopupEx` has already the right behavior, if the dialog is drawn in the window. But if you drag the popup out of the window boundaries should there still be a repositioning?
### MaterialDesignEmbeddedDialogHost
- [ ] The drag here could be realized with margins. In opposite to the default style, this is already bounded to the dialog host content or maybe window content.
- [ ] As working with margins, on resize the dialog could disappear. Here we need to develop a resize/maximize/restore strategy.
### both
- [ ] What should happen, if the dialog reopens? Should the last position persist (this would be kind of the default behavior, as the properties of the `Grid`/`Popup` would be modified on drag)?
- [ ] Should this feature be opt-in or on by default (this would be a breaking change though)?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the current Popup/PopupEx dialog implementation and the MaterialDesignEmbeddedDialogHost implementation. Resolve the listed decisions about bounds, resizing, reopening, persistence, and opt-in behavior before implementing and validating draggable dialogs for both styles.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
design, desktop
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.