【问题标题】:Adding a graphic to the a ComponentArt Grid control cell将图形添加到 ComponentArt Grid 控件单元格
【发布时间】:2010-11-26 09:53:33
【问题描述】:

我正在使用 ComponentArt Grid 控件来显示一些可以正常工作的文本,示例行如下所示。

<ComponentArt:GridColumn width="70"  DataField="ActiveState" HeadingText="Active State" />

我是数据绑定,所以上面的行显示“启用”或“禁用”,因为“ActiveState”是返回适当字符串的类的属性。我现在被要求用图形(勾号或十字)替换文本。我对这个控件不太熟悉,发现 ComponentArt 网站相当无用。谁能建议适当的格式在单元格中显示图形而不是文本?

【问题讨论】:

    标签: c# datagrid componentart


    【解决方案1】:

    我在 ComponentArt 示例网站上找到了这个:

    <Columns>
              <ComponentArt:GridColumn DataField="PriorityIcon" Align="Center" DataCellClientTemplateId="PriorityIconTemplate" HeadingCellCssClass="FirstHeadingCell" DataCellCssClass="FirstDataCell" HeadingImageUrl="icon_priority.gif" HeadingImageWidth="9" HeadingImageHeight="14" AllowGrouping="false" SortedDataCellCssClass="SortedDataCell" Width="12" FixedWidth="True" />
    

    然后像这样添加一个模板:

    <ClientTemplates>
          <ComponentArt:ClientTemplate Id="PriorityIconTemplate">
            <img src="images/## DataItem.GetMember('PriorityIcon').Value ##" width="8" height="10" border="0" >
          </ComponentArt:ClientTemplate>
    

    供参考,这里是网址,只需点击查看代码: Component art

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-02-03
      • 2013-07-01
      • 2019-01-22
      • 2014-07-11
      • 2011-08-17
      • 2015-11-09
      • 2019-01-02
      相关资源
      最近更新 更多