-
Notifications
You must be signed in to change notification settings - Fork 38
PersonPictureSettings API review #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
MikeHillberg
wants to merge
7
commits into
master
Choose a base branch
from
user/mikehillberg/PersonPictureReview
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1d666a4
Review copy
60715fb
Merge branch 'master' into user/mikehillberg/PersonPictureReview
2927f07
Updates
9474c1c
Updates
e27e447
Updates
b05114b
review updates
jevansaks b022be1
Add back the sentence that was lost
jevansaks File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# Background | ||
|
||
Xaml controls are typically implemented using an element tree that’s defined in a template. | ||
For example the template for a ComboBox control has a TextBlock in it to display the selected value. | ||
|
||
Several controls have properties that are only expected to be useful to these templates, | ||
and so there’s a common pattern for the control to expose them in a TemplateSettings property. | ||
For example [ComboBox.TemplateSettings](https://docs.microsoft.com/en-us/uwp/api/Windows.UI.Xaml.Controls.ComboBox.TemplateSettings) | ||
is used by the ComboBox’s template. See [this doc page](https://docs.microsoft.com/en-us/windows/uwp/xaml-platform/template-settings-classes) for more details. | ||
|
||
This API update introduces this pattern to the PersonPicture control: | ||
a new TemplateSettings property and associated PersonPictureTemplateSettings class. | ||
|
||
# Description | ||
|
||
Provides calculated values that can be referenced as TemplatedParent sources when defining templates | ||
for a PersonPicture control. Not intended for general use. | ||
|
||
# API Details | ||
|
||
``` | ||
namespace Microsoft.UI.Xaml.Controls | ||
{ | ||
[webhosthidden] | ||
unsealed runtimeclass PersonPicture : Windows.UI.Xaml.Controls.Control | ||
{ | ||
... | ||
|
||
PersonPictureTemplateSettings TemplateSettings { get; }; | ||
|
||
... | ||
} | ||
|
||
[webhosthidden] | ||
runtimeclass PersonPictureTemplateSettings : Windows.UI.Xaml.DependencyObject | ||
{ | ||
String ActualInitials { get; }; | ||
Windows.UI.Xaml.Media.ImageBrush ActualImageBrush { get; }; | ||
} | ||
|
||
} | ||
``` | ||
|
||
# Examples | ||
|
||
This is intended for use in the style of the `PersonPicture` control. Sample usage: | ||
|
||
```xaml | ||
<Style TargetType="local:PersonPicture"> | ||
... | ||
<Setter Property="Template"> | ||
<Setter.Value> | ||
<ControlTemplate TargetType="local:PersonPicture"> | ||
<Grid x:Name="RootGrid"> | ||
<VisualStateManager.VisualStateGroups> | ||
<VisualStateGroup x:Name="CommonStates"> | ||
<!-- Visual State when a Photo is available for display --> | ||
<VisualState x:Name="Photo"> | ||
<VisualState.Setters> | ||
<Setter Target="PersonPictureEllipse.Fill" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ActualImageBrush}"/> | ||
</VisualState.Setters> | ||
</VisualState> | ||
... | ||
<TextBlock | ||
... | ||
Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ActualInitials}" /> | ||
|
||
``` | ||
|
||
# API Notes | ||
|
||
## Class: PersonPicture | ||
| Member Name | Description | | ||
|:- |:--| | ||
| TemplateSettings | Provides calculated values that can be referenced as TemplatedParent sources when defining templates for a PersonPicture control. Not intended for general use. | | ||
|
||
## Class: PersonPictureTemplateSettings | ||
| Member Name | Description | | ||
|:- |:--| | ||
| ActualInitials | The initials that should be displayed in the control. Empty when an image is specified or when the PersonPicture control represents a group. | | ||
| ActualImageBrush | The image brush to use in the control. The PersonPicture control determines which image to use based on how it was configured. This property will be null when no image should be displayed. | |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.