Skip to content

Instantly share code, notes, and snippets.

@julesx
Last active December 1, 2015 20:53
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/708b9f660cb65db0c922 to your computer and use it in GitHub Desktop.
Save julesx/708b9f660cb65db0c922 to your computer and use it in GitHub Desktop.
[MarkupExtensionReturnType(typeof(ContentControl))]
public class RootObject : MarkupExtension
{
public override object ProvideValue(IServiceProvider serviceProvider)
{
var rootObjectProvider = (IRootObjectProvider)serviceProvider.GetService(typeof(IRootObjectProvider));
return rootObjectProvider?.RootObject;
}
}
<ContextMenu DataContext="{Binding DataContext, Source={_3RdParty:RootObject}}">
<MenuItem Header="Remove" Command="{Binding CmdRemoveControllerOperation}" CommandParameter="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}}}" />
</ContextMenu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment