本文整理汇总了C#中Visual.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# Visual.GetValue方法的具体用法?C# Visual.GetValue怎么用?C# Visual.GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Visual
的用法示例。
在下文中一共展示了Visual.GetValue方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateAdornedElement
private void UpdateAdornedElement(Visual adorner, Visual adorned)
{
var info = adorner.GetValue(AdornedElementInfoProperty);
if (info != null)
{
info.Subscription.Dispose();
if (adorned == null)
{
adorner.ClearValue(AdornedElementInfoProperty);
}
}
if (adorned != null)
{
if (info == null)
{
info = new AdornedElementInfo();
adorner.SetValue(AdornedElementInfoProperty, info);
}
info.Subscription = this.tracker.Track(adorned).Subscribe(x =>
{
info.Bounds = x;
this.InvalidateArrange();
});
}
}
示例2: GetAdornedElement
public static Visual GetAdornedElement(Visual adorner)
{
return adorner.GetValue(AdornedElementProperty);
}
示例3: GetAdornerLayerCache
private static AdornerLayer GetAdornerLayerCache(Visual visual)
{
return (AdornerLayer)visual.GetValue(AdornerLayerCacheProperty);
//return AdornerLayer.GetAdornerLayer(visual);
}
示例4: GetDragsWindow
/// <summary>
/// Gets the value of the WindowMovement.DragsWindow attached property on a Visual.
/// </summary>
/// <param name="window">The Visual to set the property on.</param>
/// <returns>The value of the property on the Visual.</returns>
public static bool GetDragsWindow(Visual visual)
{
return (bool) visual.GetValue(DragsWindow);
}
示例5: GetDragsWindow
/// <summary>
/// Gets the value of the WindowMovement.DragsWindow attached property on a Visual.
/// </summary>
/// <param name="window">The Visual to set the property on.</param>
/// <returns>The value of the property on the Visual.</returns>
public static bool GetDragsWindow(Visual window)
{
return (bool)window.GetValue(DragsWindow);
}
示例6: GetTransformedBounds
/// <summary>
/// Gets the transformed bounds of the visual.
/// </summary>
/// <param name="visual">The visual.</param>
/// <returns>The transformed bounds.</returns>
public static TransformedBounds GetTransformedBounds(Visual visual) => visual.GetValue(TransformedBoundsProperty);
示例7: MakeVisible
public Rect MakeVisible(Visual visual, Rect rectangle)
{
double itemCanvasLeft = (double)visual.GetValue(Canvas.LeftProperty);
double itemOffset = ConvertCanvasLeftToOffset(itemCanvasLeft);
// If the item is not fully in view on the left,
// adjust the offset to bring it into view.
if (itemOffset < _viewportOffset.X)
{
ScrollContent(_viewportOffset.X - itemOffset);
}
// If the item is not fully in view on the right,
// adjust the offset to bring it into view.
if (itemOffset + rectangle.Width > _viewportOffset.X + ViewportWidth)
{
ScrollContent((_viewportOffset.X + ViewportWidth) -
(itemOffset + rectangle.Width));
}
return rectangle;
}
示例8: GetNameScope
/// <summary>
/// Gets the value of the attached <see cref="NameScopeProperty"/> on a visual.
/// </summary>
/// <param name="visual">The visual.</param>
/// <returns>The value of the NameScope attached property.</returns>
public static INameScope GetNameScope(Visual visual)
{
return visual.GetValue(NameScopeProperty);
}
示例9: GetImageFromVisual
private BitmapImage GetImageFromVisual(Visual visual)
{
Thickness margin = (Thickness)visual.GetValue(MarginProperty);
if (margin == null | margin.Equals(new Thickness(0)))
{
visual.SetValue(MarginProperty, new Thickness(0));
}
MemoryStream memory = new MemoryStream();
RenderTargetBitmap bitmap = new RenderTargetBitmap(
Convert.ToInt32(visual.GetValue(ActualWidthProperty)),
Convert.ToInt32(visual.GetValue(ActualHeightProperty)),
96,
96,
PixelFormats.Pbgra32);
bitmap.Render(visual);
PngBitmapEncoder encoder = new PngBitmapEncoder();
encoder.Frames.Add(BitmapFrame.Create(bitmap));
encoder.Save(memory);
BitmapImage img = new BitmapImage();
img.BeginInit();
img.StreamSource = new MemoryStream(memory.ToArray());
img.EndInit();
memory.Dispose();
visual.SetValue(MarginProperty, margin);
return img;
}