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


C# PathGeometry.ReadLocalValue方法代码示例

本文整理汇总了C#中System.Windows.Media.PathGeometry.ReadLocalValue方法的典型用法代码示例。如果您正苦于以下问题:C# PathGeometry.ReadLocalValue方法的具体用法?C# PathGeometry.ReadLocalValue怎么用?C# PathGeometry.ReadLocalValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Media.PathGeometry的用法示例。


在下文中一共展示了PathGeometry.ReadLocalValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PathGeometryHasFigures

 // This is needed in Silverlight because of a Silverlight bug
 // that causes a Path with a PathGeometry that was created using
 // <Path ... Data="M0 0 L10 20 ..." />
 // to have ZERO Bounds after trying to access the PathGeometry.Figures property.
 //
 // In both WPF and Silverlight Paths constructed using the Path markup syntax
 // using the StreamGeometry mini-language are supposed to be "black boxes".
 // There is no way to walk the PathGeometry.Figures to determine its actual geometry.
 // One can only get the PathGeometry.Bounds.
 // We have to treat it as a rectangular shape.
 // Note: Silverlight does not support the PathFigureCollection mini-language.
 // (Example: <PathGeometry Figures="M0 0 L10 20 ..." />.)
 // WPF supports both the StreamGeometry mini-language and the PathFigureCollection mini-language.
 //
 // So if the programmer wants to use a Node containing Paths for which Links want to
 // connect at the edge of the Paths (when Spot.None, of course),
 // they have to construct a PathFigureCollection containing PathFigures.
 //
 // But in Silverlight there is a bug causing the PathGeometry to have zero Bounds
 // once our code tries to get the value of PathGeometry.Figures,
 // if the Path was defined in XAML.
 // This causes that Path to disappear, to the consternation of our customers.
 // Typically that happenened (before version 1.2.6f) when routing a link to a node
 // containing a Path defined in XAML, when the Spot was None and no surrounding
 // Panel with a Background hid the actual shape of the Path.
 //
 // Our work-around requires our code to construct each PathGeometry with an
 // explicitly created PathFigureCollection containing PathFigures.
 // Explicitly setting PathGeometry.Figures gives it a local value which
 // tells this predicate that it's OK to try to get the PathGeometry.Figures property.
 // If it hasn't been set, it won't have a local value, which means
 // (most likely) that it was created in XAML using Data="...".
 public static bool PathGeometryHasFigures(PathGeometry path) {
   object val = path.ReadLocalValue(PathGeometry.FiguresProperty);
   var pfc = val as PathFigureCollection;
   return pfc != null && pfc.Count > 0;
 }
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:37,代码来源:Geo.cs


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