首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 媒体动画 > CAD教程 >

ServerLigt动态生成列有关问题,请高人指教

2012-08-09 
ServerLigt动态生成列问题,请高人指教。这个摸板杂样动态呢?ig:TemplateColumn Key[Clm1]HorizontalCon

ServerLigt动态生成列问题,请高人指教。
这个摸板杂样动态呢?
<ig:TemplateColumn Key="[Clm1]"
  HorizontalContentAlignment="Stretch"
  VerticalContentAlignment="Stretch"
  IsSortable="False" >
  <ig:TemplateColumn.ItemTemplate>
  <DataTemplate>
  <StackPanel Width="150" Orientation="Vertical">
  <hx:HxLabel Name="lableDate"
  Background="{Binding Path=[Clm1].BackColor, Mode=TwoWay}"
  Content="{Binding Path=[Clm1].Text}"
  Foreground="{Binding Path=[Clm1].ForceColor}" />
  </StackPanel>
  </DataTemplate>
  </ig:TemplateColumn.ItemTemplate>

</ig:TemplateColumn>
我这样做的,结果显示不出来?请高人指教。
 for (int i = 0; i < colms; i++)
  {
  TemplateColumn tempColumn = new TemplateColumn();
  tempColumn.Key = "[Clm" + i + "]";
  tempColumn.IsSorted = SortDirection.None;
  StringBuilder CellTemp = new StringBuilder();
  CellTemp.Append("<DataTemplate xmlns=\"http://schemas.microsoft.com/client/2007\">");
  CellTemp.Append(" <StackPanel Width=\"150\" Orientation=\"Vertical\" xmlns=\"http://schemas.microsoft.com/client/2007\">");
  CellTemp.Append("<hx:HxLabel xmlns:hx=\"clr-namespace:xxx.Controls;assembly=xxx.Controls\"");
  CellTemp.Append(" Background=\"Red\"");
  CellTemp.Append(" Content=\"Test\"");
  CellTemp.Append(" Foreground=\"Blue\" ");
  CellTemp.Append("/>");
  CellTemp.Append("</StackPanel></DataTemplate>");
  tempColumn.AddNewRowItemTemplate = (DataTemplate)XamlReader.Load(CellTemp.ToString());
  grid.Columns.Add(tempColumn);

  }


------解决方案--------------------
http://www.cnblogs.com/luosm/articles/2261826.html
这个不行吗?试试这个

热点排行