当前位置: 首页>>代码示例>>C#>>正文


C# Visual.GetValue方法代码示例

本文整理汇总了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();
                });
            }
        }
开发者ID:Scellow,项目名称:Perspex,代码行数:29,代码来源:AdornerLayer.cs

示例2: GetAdornedElement

 public static Visual GetAdornedElement(Visual adorner)
 {
     return adorner.GetValue(AdornedElementProperty);
 }
开发者ID:Scellow,项目名称:Perspex,代码行数:4,代码来源:AdornerLayer.cs

示例3: GetAdornerLayerCache

 private static AdornerLayer GetAdornerLayerCache(Visual visual)
 {
     return (AdornerLayer)visual.GetValue(AdornerLayerCacheProperty);
     //return AdornerLayer.GetAdornerLayer(visual);
 }
开发者ID:ptownsend1984,项目名称:SampleApplications,代码行数:5,代码来源:AdornerExtensions.cs

示例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);
 }
开发者ID:nikolauska,项目名称:DewritoUpdater,代码行数:9,代码来源:WindowMovement.cs

示例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);
 }
开发者ID:ChadSki,项目名称:Quickbeam,代码行数:9,代码来源:WindowMovement.cs

示例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);
开发者ID:CarlSosaDev,项目名称:Avalonia,代码行数:6,代码来源:BoundsTracker.cs

示例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;
        }
开发者ID:igemsoftware,项目名称:BU_Wellesley_Software_2011,代码行数:22,代码来源:LoopCanvasHorizontal.cs

示例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);
 }
开发者ID:CarlSosaDev,项目名称:Avalonia,代码行数:9,代码来源:NameScope.cs

示例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;
        }
开发者ID:seojunyang,项目名称:12,代码行数:31,代码来源:GridWidget.xaml.cs


注:本文中的Visual.GetValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。