如何在Windows Phone 8中创建项目符号列表?

时间:2014-04-10 00:48:59

标签: xaml windows-phone-8

我只需要一个简单的项目列表,其前面有项目符号。我怎样才能做到这一点?我无法找到任何控件,我可以使用网格等来实现这一目标,但对于这么简单的事情来说似乎有很多工作

2 个答案:

答案 0 :(得分:13)

只需将项目符号直接插入您的XAML:

<StackPanel>
    <TextBlock Text="• Item 1"/>
    <TextBlock Text="• Item 2"/>
</StackPanel>

您还可以使用Hex HTML entity

<TextBlock>&#x2022; Item 1</TextBlock>

如果项目来自viewmodel / binding,则使用ItemsControl

<ItemsControl ItemsSource="{Binding MyItems}">
    <ItemsControl.ItemTemplate>
        <DataTemplate>
            <TextBlock Text="{Binding StringFormat='• {0}'}" />
        </DataTemplate>
    </ItemsControl.ItemTemplate>
</ItemsControl>

脚注:与Silverlight / Windows Phone无关,但WPF有BulletDecorator - example

答案 1 :(得分:1)

我使用带有子弹器的堆叠面板来显示子弹列表:

exception 



  org.apache.jasper.JasperException: An exception occurred processing JSP page /index.jsp at line 3

    1: <%@ taglib   prefix="S" uri="/struts-tags" %>  
    2:   
    3: <S:form action="register">  
    4: <S:textfield name="name" label="Name"></S:textfield>  
    5: <S:textfield name="lname" label="LName"></S:textfield>  
    6:     


 Stacktrace:
        org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:575)
        org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:477)
        org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
        org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
        org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)


    root cause 

    The Struts dispatcher cannot be found.  This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag. - [unknown location]
        org.apache.struts2.views.jsp.TagUtils.getStack(TagUtils.java:60)
        org.apache.struts2.views.jsp.StrutsBodyTagSupport.getStack(StrutsBodyTagSupport.java:44)
        org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:48)
        org.apache.jsp.index_jsp._jspx_meth_S_005fform_005f0(index_jsp.java:105)
        org.apache.jsp.index_jsp._jspService(index_jsp.java:74)
        org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
        org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:439)
        org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
        org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
        org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)


    note The full stack trace of the root cause is available in the Apache Tomcat/7.0.64 logs.