-
Notifications
You must be signed in to change notification settings - Fork 773
Open
Labels
Description
Proposal: Support DependencyPropertyKey and RegisterReadOnly as in WPF
Summary
Support is needed for read-only dependencies properties in UWP/WinUI. This is especially true for collection-type properties backed by a list that shouldn't be changed through the binding system. It will also allow several existing properties to be updated to support binding and MVVM (which is important in several application-specific scenarios).
private static readonly DependencyPropertyKey ReadOnlyPropPropertyKey =
DependencyProperty.RegisterReadOnly(...);
public static readonly DependencyProperty ReadOnlyPropProperty =
ReadOnlyPropPropertyKey.DependencyProperty;
public object ReadOnlyProp
{
get { return GetValue(ReadOnlyPropProperty); }
protected set { SetValue(ReadOnlyPropPropertyKey, value); }
}Rationale
This is needed several places (examples listed below) and has been a rather large architectural gap since UWP inception as compared to WPF.
- <Control>.SelectedItems
- TwoPaneView.Mode
- MenuBar.Items
Scope
| Capability | Priority |
|---|---|
| Add DependencyPropertyKey | Must |
| Add DependencyProperty.RegisterReadOnly | Must |
Important Notes
Switching to using read-only DPs in existing controls would be a binary breaking change but as the property accessors could be the same it would be minor. It would just enable binding.
Also see the discussions here:
Kinnara, baskren, rick-palmsens, phorks, dlbd and 3 more
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Backlog