缺少数组元素在用户控件XAML? [英] Missing Array element in UserControl XAML?

查看:147
本文介绍了缺少数组元素在用户控件XAML?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这实际上是两个问题是一个:

This is actually two questions in one:

首先,当你写你的XAML和智能感知无法识别您想要使用的类型(在我的情况下,阵列),你去什么步骤,通过弄清楚这是怎么回事?我最初看在我的XML命名空间,以确保一切看起来像它的秩序。如果它是一个CLR类型(我自己不是一个),那么我最终检查谷歌(通常无法找到我所需要的)。

First, when you write your XAML and Intellisense fails to recognize the type you want to use (in my case, Array), what steps do you go through to figure out what's going on? I initially look over my XML namespaces to make sure that everything looks like it's in order. If it's a CLR type (not one of my own), then I end up checking Google (and usually can't find what I need).

在这种情况下,我的查询是WPF XAML命名空间缺失阵,还告诉我,因为我曾怀疑,该数组中的 http://schemas.microsoft.com/winfx/2006/xaml ,但它并没有在智能感知出现。这是为什么?

In this case, my query was "XAML WPF namespace missing Array", which tells me, as I had suspected, that Array is in http://schemas.microsoft.com/winfx/2006/xaml, but it doesn't show up in Intellisense. Why is that?

所有我看到的例子是在一个窗口或应用程序,而不是像我这样的用户控件。是关系到我的问题?

All of the examples I see are in a Window or Application, not in a UserControl like mine. Is that related to my problem?

好吧,我想这在技术上是三个问题。 :)

Ok, I guess that was technically three questions. :)

推荐答案

我不知道我真正理解你的问题是关于什么的...如果你想声明在XAML一个数组,使用的 X:阵列标记扩展。例如用数组的Int32

I'm not sure I really understood what your question is about... If you want to declare an array in XAML, use the x:Array markup extension. Example with an array of Int32 :

<UserControl x:Class="YourNamespace.YourClass"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:sys="clr-namespace:System;assembly=mscorlib">

    <UserControl.Resources>
        <x:Array x:Key="arrayOfInt32" Type="sys:Int32">
            <sys:Int32>4</sys:Int32>
            <sys:Int32>8</sys:Int32>
            <sys:Int32>15</sys:Int32>
            <sys:Int32>16</sys:Int32>
            <sys:Int32>23</sys:Int32>
            <sys:Int32>42</sys:Int32>
        </x:Array>
    </UserControl.Resources>

    ...

这篇关于缺少数组元素在用户控件XAML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆