- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我已经添加了如下的xaml图形代码
<Viewbox x:key="Icon">
<Canvas Name="Layer_1" Width="200" Height="200" Canvas.Left="0" Canvas.Top="0">
<Canvas.RenderTransform>
<TranslateTransform X="0" Y="0"/>
</Canvas.RenderTransform>
<Canvas.Resources/>
<!--Unknown tag: metadata-->
<!--Unknown tag: sodipodi:namedview-->
<Canvas Name="g3">
<Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path5" Fill="#000000">
<Path.Data>
<PathGeometry Figures="M56.575 97l-9.064-21.467L37.18 51.066L26.847 75.209L17.765 97H11.99c2.322 7 12.895 14.08 25.602 14.08 S60.872 104 63.193 97H56.575z M27.767 75.602l9.407-21.973l9.415 22.292L55.491 97H18.848L27.767 75.602z" FillRule="NonZero"/>
</Path.Data>
</Path>
<Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path7" Fill="#000000">
<Path.Data>
<PathGeometry Figures="M181.87 97l-9.065-21.467l-10.332-24.467l-10.332 24.143L143.059 97h-5.773c2.321 7 12.894 14.08 25.602 14.08 c12.707 0 23.279-7.08 25.602-14.08H181.87z M153.061 75.602l9.406-21.973l9.416 22.292L180.786 97h-36.646L153.061 75.602z" FillRule="NonZero"/>
</Path.Data>
</Path>
<Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path9" Fill="#000000">
<Path.Data>
<PathGeometry Figures="G169 42h-60.375c-0.968-3.1-3.476-5.511-6.625-6.363V14c0-1.381-1.119-2.5-2.5-2.5S97 12.619 97 14v21.638 c-3.148 0.853-5.656 3.264-6.625 6.362H30c-1.381 0-2.5 1.119-2.5 2.5S28.619 47 30 47h60.191c0.788 3.436 3.424 6.156 6.809 7.072 v102.682l-48 13.465V190h101v-19.781l-48-13.465V54.072c3.385-0.915 6.021-3.637 6.81-7.072J169c1.381 0 2.5-1.119 2.5-2.5 S170.381 42 169 42z G145 185H54v-10.992l45.5-12.762l45.5 12.762V185z M104.246 45.72c-0.016 0.085-0.027 0.173-0.048 0.257 c-0.046 0.199-0.11 0.391-0.18 0.58c-0.057 0.149-0.118 0.297-0.187 0.439c-0.408 0.842-1.048 1.541-1.844 2.023 c-0.285 0.173-0.594 0.311-0.913 0.425c-0.138 0.048-0.276 0.095-0.419 0.13c-0.106 0.027-0.213 0.051-0.321 0.07 c-0.272 0.048-0.548 0.084-0.834 0.084c-0.285 0-0.562-0.036-0.833-0.084c-0.109-0.02-0.217-0.043-0.323-0.07 c-0.142-0.035-0.278-0.082-0.415-0.129c-0.322-0.115-0.634-0.254-0.922-0.429c-0.792-0.481-1.429-1.179-1.836-2.017 c-0.07-0.145-0.132-0.293-0.189-0.443c-0.069-0.189-0.135-0.382-0.181-0.582c-0.02-0.083-0.03-0.168-0.046-0.253 c-0.047-0.268-0.083-0.539-0.083-0.82c0-0.3 0.036-0.592 0.089-0.877c0.025-0.137 0.066-0.269 0.104-0.399 c0.036-0.131 0.074-0.261 0.12-0.387c0.065-0.174 0.141-0.344 0.226-0.508c0.03-0.059 0.062-0.117 0.096-0.176 c0.109-0.191 0.226-0.379 0.358-0.555c0.367-0.484 0.819-0.895 1.34-1.211c0.289-0.176 0.602-0.315 0.925-0.431 c0.137-0.047 0.273-0.094 0.415-0.128c0.106-0.027 0.214-0.052 0.323-0.072c0.271-0.047 0.548-0.084 0.833-0.084 c0.286 0 0.562 0.037 0.834 0.084c0.108 0.021 0.216 0.044 0.321 0.071c0.143 0.035 0.281 0.082 0.419 0.13 c0.32 0.115 0.63 0.252 0.916 0.427c0.523 0.317 0.977 0.728 1.345 1.214c0.134 0.176 0.25 0.365 0.36 0.558 c0.031 0.057 0.063 0.112 0.093 0.171c0.086 0.165 0.161 0.336 0.227 0.512c0.047 0.125 0.084 0.254 0.119 0.383 c0.038 0.133 0.079 0.264 0.105 0.401c0.052 0.285 0.088 0.577 0.088 0.877C104.328 45.182 104.291 45.452 104.246 45.72y" FillRule="NonZero"/>
</Path.Data>
</Path>
</Canvas>
</Canvas>
</Viewbox>
它是一个在一页中重复使用的按钮。此代码在 application.resources 中。我将它与静态资源一起使用。
<Button Name="BarcodeButton" Content="{StaticResource Icon}"></Button>
当我点击添加按钮时,它会将这个新按钮添加到页面中。我发现的问题是它只显示最新按钮。其他人都消失了。
已编辑我刚刚发现我必须 x:Shared="False"
<Viewbox x:key="Icon" x:Shared="False" >
<Canvas Name="Layer_1" Width="200" Height="200" Canvas.Left="0" Canvas.Top="0">
<Canvas.RenderTransform>
<TranslateTransform X="0" Y="0"/>
</Canvas.RenderTransform>
<Canvas.Resources/>
<!--Unknown tag: metadata-->
<!--Unknown tag: sodipodi:namedview-->
<Canvas Name="g3">
<Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path5" Fill="#000000">
<Path.Data>
<PathGeometry Figures="M56.575 97l-9.064-21.467L37.18 51.066L26.847 75.209L17.765 97H11.99c2.322 7 12.895 14.08 25.602 14.08 S60.872 104 63.193 97H56.575z M27.767 75.602l9.407-21.973l9.415 22.292L55.491 97H18.848L27.767 75.602z" FillRule="NonZero"/>
</Path.Data>
</Path>
<Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path7" Fill="#000000">
<Path.Data>
<PathGeometry Figures="M181.87 97l-9.065-21.467l-10.332-24.467l-10.332 24.143L143.059 97h-5.773c2.321 7 12.894 14.08 25.602 14.08 c12.707 0 23.279-7.08 25.602-14.08H181.87z M153.061 75.602l9.406-21.973l9.416 22.292L180.786 97h-36.646L153.061 75.602z" FillRule="NonZero"/>
</Path.Data>
</Path>
<Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path9" Fill="#000000">
<Path.Data>
<PathGeometry Figures="G169 42h-60.375c-0.968-3.1-3.476-5.511-6.625-6.363V14c0-1.381-1.119-2.5-2.5-2.5S97 12.619 97 14v21.638 c-3.148 0.853-5.656 3.264-6.625 6.362H30c-1.381 0-2.5 1.119-2.5 2.5S28.619 47 30 47h60.191c0.788 3.436 3.424 6.156 6.809 7.072 v102.682l-48 13.465V190h101v-19.781l-48-13.465V54.072c3.385-0.915 6.021-3.637 6.81-7.072J169c1.381 0 2.5-1.119 2.5-2.5 S170.381 42 169 42z G145 185H54v-10.992l45.5-12.762l45.5 12.762V185z M104.246 45.72c-0.016 0.085-0.027 0.173-0.048 0.257 c-0.046 0.199-0.11 0.391-0.18 0.58c-0.057 0.149-0.118 0.297-0.187 0.439c-0.408 0.842-1.048 1.541-1.844 2.023 c-0.285 0.173-0.594 0.311-0.913 0.425c-0.138 0.048-0.276 0.095-0.419 0.13c-0.106 0.027-0.213 0.051-0.321 0.07 c-0.272 0.048-0.548 0.084-0.834 0.084c-0.285 0-0.562-0.036-0.833-0.084c-0.109-0.02-0.217-0.043-0.323-0.07 c-0.142-0.035-0.278-0.082-0.415-0.129c-0.322-0.115-0.634-0.254-0.922-0.429c-0.792-0.481-1.429-1.179-1.836-2.017 c-0.07-0.145-0.132-0.293-0.189-0.443c-0.069-0.189-0.135-0.382-0.181-0.582c-0.02-0.083-0.03-0.168-0.046-0.253 c-0.047-0.268-0.083-0.539-0.083-0.82c0-0.3 0.036-0.592 0.089-0.877c0.025-0.137 0.066-0.269 0.104-0.399 c0.036-0.131 0.074-0.261 0.12-0.387c0.065-0.174 0.141-0.344 0.226-0.508c0.03-0.059 0.062-0.117 0.096-0.176 c0.109-0.191 0.226-0.379 0.358-0.555c0.367-0.484 0.819-0.895 1.34-1.211c0.289-0.176 0.602-0.315 0.925-0.431 c0.137-0.047 0.273-0.094 0.415-0.128c0.106-0.027 0.214-0.052 0.323-0.072c0.271-0.047 0.548-0.084 0.833-0.084 c0.286 0 0.562 0.037 0.834 0.084c0.108 0.021 0.216 0.044 0.321 0.071c0.143 0.035 0.281 0.082 0.419 0.13 c0.32 0.115 0.63 0.252 0.916 0.427c0.523 0.317 0.977 0.728 1.345 1.214c0.134 0.176 0.25 0.365 0.36 0.558 c0.031 0.057 0.063 0.112 0.093 0.171c0.086 0.165 0.161 0.336 0.227 0.512c0.047 0.125 0.084 0.254 0.119 0.383 c0.038 0.133 0.079 0.264 0.105 0.401c0.052 0.285 0.088 0.577 0.088 0.877C104.328 45.182 104.291 45.452 104.246 45.72y" FillRule="NonZero"/>
</Path.Data>
</Path>
</Canvas>
</Canvas>
</Viewbox>
它工作正常。
最佳答案
这是因为您将内容设置为静态资源。您必须将样式或模板设置为静态资源。
<ControlTemplate x:Key="Icon">
<Button>
<Canvas>
...
</Canvas>
</Button>
</ControlTemplate>
<Button Name="BarcodeButton" Template="{StaticResource Icon}"></Button>
关于c# - Tha xaml 图形在页面中有多个位置时消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19809937/
我一直在为此而苦苦挣扎。我想插入一个图像,并将其“靠近”讨论该图像的文本,但是该页面上的文本将围绕图像环绕/流动。 我已将图像转换为eps格式。最初,我尝试使用图形环境(\begin {figure}
我在用户界面中创建了管理控制台,管理员可以在其中执行所有操作,例如创建、删除用户、向用户分配应用程序以及从用户界面删除用户的应用程序访问权限 我厌倦了使用 Microsoft 图形 API 和 Azu
我在用户界面中创建了管理控制台,管理员可以在其中执行所有操作,例如创建、删除用户、向用户分配应用程序以及从用户界面删除用户的应用程序访问权限 我厌倦了使用 Microsoft 图形 API 和 Azu
我想为计算机图形学类(class)做一个有趣的项目。我知道那里有很多文献(即 SIGGRAPH session 论文)。我对计算机图形学(即图像处理、3D 建模、渲染、动画)兴趣广泛。但是,我只学了
我试图在 MaterializeCSS 网站上创建一些类似于这个的图形,但我不知道它来自哪里,我查看了整个 MaterializeCSS 网站,它不是框架的一部分,我找不到在代码中他们使用的是什么 我
我有一个包含 1 到 6 之间的各种数字的 TextView ,每个数字在每一行上代表一次,例如 123456 213456 214356 ...... 我希望能够绘制一条蓝线来跟随单个数值在列表中向
我目前在 Windows 7 上使用 Netbeans 和 Cygwin,我希望用 C 语言编写一个简单的 2D 游戏。 我设法找到的大多数教程都使用 Turbo C 提供的 graphics.h,C
亲爱的,我正在尝试将 kaggle 教程代码应用于 Iris 数据集。 不幸的是,当我执行图表的代码时,我只能看到这个输出而看不到任何图表: matplotlib.axes._subplots.Axe
我需要加快我正在处理的一些粒子系统的视觉效果。令人眼前一亮的是添加混合、积累以及粒子上的轨迹和发光。目前我正在手动渲染到浮点图像缓冲区,在最后一分钟转换为无符号字符,然后上传到 OpenGL 纹理。为
在研究跨网络的最短路径算法时,我想生成网络图片。我想代表节点(圆圈)、链接(线)、遍历链接的成本(链接线中间的数字)和链接的容量(链接线上它代表的节点旁边的数字)在这张图中。是否有任何库/软件可以帮助
尽管我已将应用程序从库添加到 Azure AD,但我无法看到何时尝试提取数据。但我可以看到添加的自定义应用程序。就像我添加了 7 个应用程序一样; 2 个来自图库(Google 文档、一个驱动器)和
因此,我正在构建一个系统,该系统具有“人员”,“银行帐户”和“银行帐户交易”。 我需要能够回答以下问题: “将所有与1/2/3度有联系的人归还给特定的人”, “返回年龄在40岁以上的所有人” “从德国
我在 JFrame 构造函数中有以下简单代码 super(name); setBounds(0,0,1100,750); setLayout(null); setVis
(这是java)我有一个椭圆形,代表一个单位。我希望椭圆形的颜色代表单位的健康状况。因此,一个完全健康的单位将是全绿色的。随着单位生命值的降低,椭圆形开始从底部填充红色。因此,在 50% 生命值下,椭
我目前正在开发一个学校项目。我们必须制作一个Applet,我选择了JApplet。由于某种原因,我用来显示特定字符串的面板将不会显示。这里可能有什么问题?请指出我正确的方向。另外,我看了一些教程,
我正在尝试创建一个 Simon game 。我正在编写游戏程序,但遇到了问题。我希望程序从队列中读取游戏中之前存在的所有值,并以正确的顺序将它们的颜色变为闪烁(我选择将它们变为灰色,然后在第二秒后恢复
我正在尝试创建一个框架,该框架在同一框架的顶部有一个图形面板(通过布局),在其下方有一个按钮/标签面板。到目前为止,我似乎已经能够将它们放在同一个框架上,但与按钮/标签面板相比,图形面板非常小....
我用 Java 编写了一个解决数独问题的代码,并使用 Java Applet 来设计它。现在,我尝试使用 Java Swing 使其看起来更好,并添加一些功能,例如“保存”数独板等。不幸的是,我对 J
就目前情况而言,这个问题不太适合我们的问答形式。我们希望答案得到事实、引用资料或专业知识的支持,但这个问题可能会引发辩论、争论、民意调查或扩展讨论。如果您觉得这个问题可以改进并可能重新开放,visit
我现在尝试了 8 个多小时来解决这个问题,但无法弄清楚,请帮助找出我的代码有什么问题。 int main() { int gd = DETECT, gm; float ANGLE =
我是一名优秀的程序员,十分优秀!