Repository navigation
Menu: changed MenuItem Header to type object - #1294
Conversation
| /// Identifies the <see cref="Header"/> dependency property. | ||
| /// </summary> | ||
| public static readonly DependencyProperty HeaderProperty = DependencyProperty.Register(nameof(Header), typeof(string), typeof(MenuItem), new PropertyMetadata(default(string))); | ||
| public static readonly DependencyProperty HeaderProperty = DependencyProperty.Register(nameof(Header), typeof(object), typeof(MenuItem), new PropertyMetadata(null)); |
There was a problem hiding this comment.
This way you can do something like
<controls:MenuItem Name="FileMenu"
controls:Menu.InputGestureText="Alt+F">
<controls:MenuItem.Header>
<StackPanel Orientation="Horizontal">
<SymbolIcon Symbol="Accept"></SymbolIcon>
<TextBlock Text="Hello"></TextBlock>
</StackPanel>
</controls:MenuItem.Header>
</controls:MenuItem>There was a problem hiding this comment.
Because of content is object, I looked through the code
skendrot
left a comment
There was a problem hiding this comment.
Should have Header and HeaderTemplate
skendrot
left a comment
There was a problem hiding this comment.
Why not just make it a ContentControl?
|
@skendrot we can't because it is already an ItemsControl |
|
Good point! |
|
Should still allow to override template |
|
I agree, we need to add new property HeaderTemplate and bind it to the Button template in the menu |
skendrot
left a comment
There was a problem hiding this comment.
Should the Header be changed or add a property to show icons?
|
No icons please :) if he needs he can override. |
|
IMO, The MenuItem can always be re-styled to change the header template. |
|
Sorry I missed that MenuFlyoutItem has Icon property in #1293. MenuItem does not need to have Icon by default. |
|
I'm with adding a header template :) can we merge this PR and will add it with my current PR ? |
|
Header and HeaderTemplate go have in hand. Just like Content and ContentTemplate |
|
@IbraheemOsama, do you mind pushing the ContentTemplate to this PR, you should just be able to push to this branch? |
|
@nmetulev sure, no problem at all, will push ContentTemplate to this branch. |
| /// </summary> | ||
| public static readonly DependencyProperty HeaderTemplateProperty = DependencyProperty.Register(nameof(HeaderTemplate), typeof(DataTemplate), typeof(MenuItem), new PropertyMetadata(null)); | ||
|
|
||
| /// <summary> |
There was a problem hiding this comment.
I think this should be updated
| set { SetValue(HeaderProperty, value); } | ||
| } | ||
|
|
||
| /// <summary> |
There was a problem hiding this comment.
Should point to HeaderTemplate (not Header)
|
@IbraheemOsama, you are reading my mind cause you fixed it at the same time as I commented. Looks good to me |
re #1293, allows having other content than string inside a MenuItem