本文整理汇总了C#中System.Windows.Controls.MenuItem.TranslatePoint方法的典型用法代码示例。如果您正苦于以下问题:C# MenuItem.TranslatePoint方法的具体用法?C# MenuItem.TranslatePoint怎么用?C# MenuItem.TranslatePoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.MenuItem
的用法示例。
在下文中一共展示了MenuItem.TranslatePoint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MainWindow
public MainWindow(IContainer container)
{
InitializeComponent();
_background = new SolidColorBrush(Color.FromRgb(0x24, 0x27, 0x28));
// _background =
// new ImageBrush(new BitmapImage(new Uri(@"Images/grid.jpg", UriKind.Relative)))
// {
// Stretch = Stretch.None,
// TileMode = TileMode.Tile,
// AlignmentX = AlignmentX.Left,
// AlignmentY = AlignmentY.Top,
// Viewport = new Rect(0, 0, 128, 128),
// ViewportUnits = BrushMappingMode.Absolute
// };
Application.Current.Resources["Dunno"] = Application.Current.Resources["Dunno1"];
var compositeNode = new CompositeNode(new NodeDispatcher("Graph Dispatcher"));// TestNodes.Test3(new NodeDispatcher("Graph Dispatcher"));
_compositeNodeViewModel = new CompositeNodeViewModel(compositeNode, new Vector(), new ControlTypesResolver());
MainNode.DataContext = _compositeNodeViewModel;
var contextMenu = new ContextMenu();
MainNode.ContextMenu = contextMenu;
var nodeTypes = container != null ? container.ResolveNamed<IEnumerable<Type>>("NodeTypes") : Enumerable.Empty<Type>();
foreach (var nodeType in nodeTypes)
{
var menuItem = new MenuItem { Header = nodeType.Name };
menuItem.Click += (sender, args) => MenuItemOnClick(nodeType, MainNode.TranslatePosition(menuItem.TranslatePoint(new Point(), this)));
contextMenu.Items.Add(menuItem);
}
}