SilverlightShow: The DataGrid Column types Comments http://www.silverlightshow.net/ Silverlight articles, Silverlight tutorials, Silverlight videos, Silverlight samples SilverlightShow.net http://www.rssboard.org/rss-specification Argotic Syndication Framework 2008.0.2.0, http://www.codeplex.com/Argotic en-US estoychev@completit.com (Emil Stoychev) RE: The DataGrid Column types Hi Enrai, <p>can we use DataGridTemplateColumn to generate column at run time?</p> <p>for example i have following class.</p> <p><span style="font-family: times new roman; font-size: 18pt; color: rgb(43, 145, 175);"></span></p> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <meta content="Word.Document" name="ProgId" /> <meta content="Microsoft Word 11" name="Generator" /> <meta content="Microsoft Word 11" name="Originator" /> <link href="file:///C:%5CDOCUME%7E1%5CAVTAR%7E1.SOH%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C02%5Cclip_filelist.xml" rel="File-List" /><!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:PunctuationKerning/> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:Compatibility> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> <w:DontGrowAutofit/> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]--> <style> <!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} p {mso-margin-top-alt:auto; margin-right:0in; mso-margin-bottom-alt:auto; margin-left:0in; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} span.EmailStyle15 {mso-style-type:personal; mso-style-noshow:yes; mso-ansi-font-size:10.0pt; mso-bidi-font-size:10.0pt; font-family:Arial; mso-ascii-font-family:Arial; mso-hansi-font-family:Arial; mso-bidi-font-family:Arial; color:windowtext;} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.Section1 {page:Section1;} --> </style> <!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--> <p><span style="font-size: 10pt; color: rgb(43, 145, 175);">List</span><span style="font-size: 10pt;"><<span style="color: rgb(43, 145, 175);">Employee</span>> employees = <span style="color: blue;">new</span> <span style="color: rgb(43, 145, 175);">List</span><<span style="color: rgb(43, 145, 175);">Employee</span>>() { <o:p></o:p></span></p> <p><span style="font-size: 10pt; color: blue;">new</span><span style="font-size: 10pt;"> <span style="color: rgb(43, 145, 175);">Employee</span>() { Name=<span style="color: rgb(163, 21, 21);">"aaa"</span>, PhoneNumbers=<span style="color: blue;">new</span> <span style="color: rgb(43, 145, 175);">List</span><<span style="color: blue;">string</span>> { <span style="color: rgb(163, 21, 21);">"111"</span>, <span style="color: rgb(163, 21, 21);">"222"</span> } },<o:p></o:p></span></p> <p><span style="font-size: 10pt; color: blue;">new</span><span style="font-size: 10pt;"> <span style="color: rgb(43, 145, 175);">Employee</span>() { Name=<span style="color: rgb(163, 21, 21);">"bbb"</span>, PhoneNumbers=<span style="color: blue;">new</span> <span style="color: rgb(43, 145, 175);">List</span><<span style="color: blue;">string</span>> { <span style="color: rgb(163, 21, 21);">"333"</span>, <span style="color: rgb(163, 21, 21);">"444"</span> } },<o:p></o:p></span></p> <p><span style="font-size: 10pt; color: blue;">new</span><span style="font-size: 10pt;"> <span style="color: rgb(43, 145, 175);">Employee</span>() { Name=<span style="color: rgb(163, 21, 21);">"ccc"</span>, PhoneNumbers=<span style="color: blue;">new</span> <span style="color: rgb(43, 145, 175);">List</span><<span style="color: blue;">string</span>> { <span style="color: rgb(163, 21, 21);">"555"</span>, <span style="color: rgb(163, 21, 21);">"666"</span> } },<o:p></o:p></span></p> <p><span style="font-size: 10pt;">};<o:p></o:p></span></p> <p><span style="font-family: times new roman; font-size: 18pt;"><o:p></o:p></span></p> <p> </p> <p>I want my Name property to be first column and rest column of datagrid would be the list of phone number.</p> <p>Count of Phone number is decided at run time only, but remain static across all object.</p> <p> for example if first user have 4 phone number then remaining all will have 4 phone number.</p> <p> I am able to achieve this functionality by code behind, but is their any way to achieve the same with template.</p> <p> </p> <p> </p> <p> </p> <input type="hidden" id="gwProxy" /><!--Session data--><input type="hidden" id="jsProxy" onclick="jsCall();" /> <div id="refHTML"></div> http://www.silverlightshow.net/items/The-DataGrid-Column-types.aspx#comment1580 Avtar http://www.silverlightshow.net/items/The-DataGrid-Column-types.aspx Tue, 19 May 2009 02:30:58 GMT RE: The DataGrid Column types <p>No, there is no Group header, at least for now. You can use the Template colum to create an illusion that there are two columns under one header. ;)</p> http://www.silverlightshow.net/items/The-DataGrid-Column-types.aspx#comment414 Enrai http://www.silverlightshow.net/items/The-DataGrid-Column-types.aspx Thu, 18 Sep 2008 08:05:47 GMT RE: The DataGrid Column types <p>Is there Group Header?<br /> I want to have two columns share one header.</p> http://www.silverlightshow.net/items/The-DataGrid-Column-types.aspx#comment401 mingliangli http://www.silverlightshow.net/items/The-DataGrid-Column-types.aspx Wed, 17 Sep 2008 09:13:49 GMT