Skip to content

Instantly share code, notes, and snippets.

@julesx
Created December 1, 2015 21:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save julesx/e36fe4c06850690b2be9 to your computer and use it in GitHub Desktop.
Save julesx/e36fe4c06850690b2be9 to your computer and use it in GitHub Desktop.
<Button VerticalAlignment="Center" Style="{StaticResource HyperlinkButton}" Content="{Binding SelectedMonth.Month}">
<Button.ContextMenu>
<ContextMenu DataContext="{Binding PlacementTarget, RelativeSource={RelativeSource Self}}">
<ContextMenu.Resources>
<Style TargetType="MenuItem" BasedOn="{StaticResource MetroMenuItem}">
<Setter Property="Header" Value="{Binding Month}" />
<Setter Property="Command" Value="{Binding RelativeSource={RelativeSource AncestorType=DockPanel}, Path=DataContext.CmdFetchConversationByMonth}"/>
<Setter Property="CommandParameter" Value="{Binding}"/>
</Style>
</ContextMenu.Resources>
<ContextMenu.ItemsSource>
<CompositeCollection>
<CollectionContainer Collection="{Binding Source={StaticResource Months}}" />
</CompositeCollection>
</ContextMenu.ItemsSource>
</ContextMenu>
</Button.ContextMenu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment