Adding dynamic columns in Silverlight Datagrid
Posted in Silverlight, tagged DataGrid, Silverlight on March 20, 2008 | 1 Comment »
This post shows how to add button column to a datagrid(Silverlight) and react to the click event
1.Create a resource for the DataGridtemplateColumn, define CellTemplate
2.After setting the ItemsSource, get the resource we added in step 1 and add it to the grid
this is XAML from the page
<UserControl x:Class=”SilverlightApplication1.Page”
xmlns=”http://schemas.microsoft.com/client/2007“
xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml“
Width=”600″ Height=”600″
xmlns:data=”clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data”
xmlns:local=”clr-namespace:SilverlightApplication1;assembly=SilverlightApplication1″>
<UserControl.Resources>
<data:DataGridTemplateColumn [...]