<metro>UI

        在内核中有三个重要的空间,例如Windows.UI.Xaml.Markup,提供了Xaml支持的API应用程序。例如它的类有XamlReader,抽象的读取器类,提供快速没有缓存的Xml数据。下面例题3.

      

Using System.Xml;
Private void button_Click(object sender , EventArgs e)
{    richTextBox1.Clear();
     XmlReader rdr = XmlReader.Create(“books.xml”);
     while(rdr.Read())
{     if(rdr.NodeType == XmlNodeType.Text)
       richTextBox1.AppendText(rdr.Value + “\r\n”);
 }
}

      在数据和内容中,Windows.UI.Xaml.Data定义了数据绑定的应用程序的基础设施。它有Binding/BindingBase等类。Binding类可以实现目标和数据源的绑定。
      Windows.UI.Xaml.Documents提供基本的文本和文档模型的类。例如斜体/粗体/段落等。例题4如下。

string s = "Hello";

// Create the binding description.
Binding b = new Binding();
b.Mode = BindingMode.OneTime;
b.Source = s;

// Attach the binding to the target.
MyText.SetBinding(TextBlock.TextProperty, b);

      Graphics制图,Windows.UI.Xaml.Media提供基本的媒体支持/图形绘制。ArcSegment绘制一段椭圆的弧形,EllipseGeometry圆形或椭圆形。
      Windows.UI.Xaml.Media.Animation提供动画/故事集的API和组件。BeginStoryborad开始动画和故事的触发器。BounceEase创建跳跃。

      Windows.UI.Xaml.Shapes提供基本的形状,用来装饰/合成形状。Ellipse椭圆Line直线Ploygon多边形Ployline多线。接着看例题5.

<StackPanel>
        <Ellipse
         Fill="Yellow"
         Height="100"
         Width="200"
         StrokeThickness="2"
         Stroke="Black"/>
 </StackPanel>

<Canvas>
  <Polygon
    Points="300,200 400,125 400,275"
    Stroke="Purple"
    StrokeThickness="2">
    <Polygon.Fill>
       <SolidColorBrush Color="Blue" Opacity="0.4"/>
    </Polygon.Fill>
  </Polygon> 
</Canvas>
原文地址:https://www.cnblogs.com/virgil/p/2675330.html