zoukankan      html  css  js  c++  java
  • 在silverlight中实现对控件的deepcopy

    使用XamlReader.Load(string)方法实现
    步骤:
     

    Xamlreader.load的用法:

    1,在界面中拖拽自定义控件,设置布局和位置;

    2,拷贝自定义控件代码,放入另外的xml文件中,在标记头加上命名空间和程序集声明,删除不必要的属性。这里要注意

     xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"
     xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\" 
    一定要有

    3,使用xamlreader.load加载

    public static FillSymbol loadfillsymbol()
            {
                string strxaml = "<symbol:FillSymbol xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"  xmlns:arcsample=\"clr-namespace:arcgissampleApp.MAP;assembly=arcgissampleApp\" xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\" xmlns:symbol=\"clr-namespace:ESRI.ArcGIS.Client.Symbols;assembly=ESRI.ArcGIS.Client\" Fill=\"Red\" BorderThickness=\"2\">" +
                    "<symbol:FillSymbol.ControlTemplate>"+
                        "<ControlTemplate>"+
                            "<Grid x:Name=\"RootElement\">"+
                                "<Grid.RowDefinitions>"+
                                    "<RowDefinition Height=\"100\"/>"+
                                    "<RowDefinition/>"+
                                "</Grid.RowDefinitions>"+
                                "<Grid.ColumnDefinitions>"+
                                    "<ColumnDefinition Width=\"100\"/>"+
                                    "<ColumnDefinition/>"+
                                "</Grid.ColumnDefinitions>"+
                                "<Path Grid.RowSpan=\"2\" Grid.ColumnSpan=\"2\" x:Name=\"Element\" Fill=\"{Binding Attributes[COLOR]}\" Stroke=\"Red\" StrokeThickness=\"1\" />"+
                                "<TextBlock Grid.RowSpan=\"2\" Grid.ColumnSpan=\"2\" Text=\"{Binding Attributes[NAME]}\" FontSize=\"20\" Foreground=\"Black\" HorizontalAlignment=\"Center\" VerticalAlignment=\"Center\">"+
                                "</TextBlock>"+
                                "<arcsample:SilverlightControl2 Grid.RowSpan=\"2\" Grid.ColumnSpan=\"2\" Margin=\"-100,-50,0,0\"  Grid.Row=\"0\" Grid.Column=\"0\" x:Name=\"sc2\" SelectedGroupM=\"{Binding Attributes[GGG]}\" HorizontalAlignment=\"Center\" VerticalAlignment=\"Center\"/>" +
                            "</Grid>"+
                        "</ControlTemplate>"+
                    "</symbol:FillSymbol.ControlTemplate></symbol:FillSymbol>";
                FillSymbol symbol = XamlReader.Load(strxaml) as FillSymbol;
                return symbol;
            }
  • 相关阅读:
    PyCharm配置 Git 教程
    Docker实践:基于python:3.7.1-stretch制作python镜像
    Docker开启远程安全访问
    Centos7安装apt-get
    Kubernetes 系列(二):在 Linux 部署多节点 Kubernetes 集群与 KubeSphere 容器平台
    微信小程序调试mock 数据,提示合法域名校验失败
    babel-plugin-import 配置多个组件按需加载时
    docker run -p 8070:80 -d nginx
    数据库的设计(E-R图,数据库模型图,三大范式)
    数据库 范式
  • 原文地址:https://www.cnblogs.com/malingbo/p/2207646.html
Copyright © 2011-2022 走看看