本文整理汇总了C#中System.Windows.Controls.Grid.AbsoluteTransformPositionTo方法的典型用法代码示例。如果您正苦于以下问题:C# Grid.AbsoluteTransformPositionTo方法的具体用法?C# Grid.AbsoluteTransformPositionTo怎么用?C# Grid.AbsoluteTransformPositionTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.Grid
的用法示例。
在下文中一共展示了Grid.AbsoluteTransformPositionTo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddProxyMenuUI
private void AddProxyMenuUI(Menu currentMenu)
{
_ic
.FindAllElementsByType<Grid>()
.ObserveOnDispatcher()
.Subscribe(c =>
{
var text = c.FindElement<TextBlock>();
var i = _ic.Items.IndexOf(text.Text);
//skip the current menu
var m = CorrectChildren.ElementAt(i) as Menu;
if (m != null && m.Equals(currentMenu)) return;
var menuParentPosition = c.GetPosition(Application.Current.RootVisual);
var adjustedPosition = new Point(menuParentPosition.X + 7, menuParentPosition.Y);
var ng = new Grid
{
Background = new SolidColorBrush(Colors.Transparent),
Width = text.ActualWidth,
Height = 22,
HorizontalAlignment = HorizontalAlignment.Left,
VerticalAlignment = VerticalAlignment.Top,
Tag = "proxy"
};
ng.MouseEnter += (_, __) =>
{
if (_hoverShow)
{
ShowMenu(c, CorrectChildren.ElementAt(i) as Menu, true);
}
else
{
ExtendedVisualStateManager.GoToElementState(c, "Hover", true);
}
};
ng.MouseLeave += (_, __) =>
ExtendedVisualStateManager.GoToElementState(c, "Normal", true);
ng.MouseLeftButtonDown += (_, args) =>
{
ShowMenu(c, CorrectChildren.ElementAt(i) as Menu, true);
args.Handled = true;
};
MenuLayer.Children.Add(ng);
ng.AbsoluteTransformPositionTo(adjustedPosition, Application.Current.RootVisual);
});
}