6 changed files with 43 additions and 1 deletions
@ -0,0 +1,20 @@ |
|||
namespace Perspex.Controls |
|||
{ |
|||
using Primitives; |
|||
|
|||
public class ContextMenu : SelectingItemsControl |
|||
{ |
|||
public static readonly AttachedProperty<ContextMenu> MenuProperty = |
|||
PerspexProperty.RegisterAttached<ContextMenu, TextBlock, ContextMenu>("Menu"); |
|||
|
|||
public static ContextMenu GetMenu(TextBlock element) |
|||
{ |
|||
return element.GetValue(MenuProperty); |
|||
} |
|||
|
|||
public static void SetMenu(TextBlock element, ContextMenu value) |
|||
{ |
|||
element.SetValue(MenuProperty, value); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,15 @@ |
|||
<Style xmlns="https://github.com/perspex" Selector="ContextMenu"> |
|||
<Setter Property="Template"> |
|||
<ControlTemplate> |
|||
<Border Background="{TemplateBinding Background}" |
|||
BorderBrush="{TemplateBinding BorderBrush}" |
|||
BorderThickness="{TemplateBinding BorderThickness}" |
|||
Padding="{TemplateBinding Padding}"> |
|||
<ItemsPresenter Name="PART_ItemsPresenter" |
|||
Items="{TemplateBinding Items}" |
|||
ItemsPanel="{TemplateBinding ItemsPanel}" |
|||
KeyboardNavigation.TabNavigation="Continue"/> |
|||
</Border> |
|||
</ControlTemplate> |
|||
</Setter> |
|||
</Style> |
|||
Loading…
Reference in new issue