I have the silverlight Datagrid like ,
I need to add one button in Every Row and If I click that button it will redirect to another page with particular row's Name Value.Because I need to show the Name value in the redirected Page.
Am new to Silverlight Application.Need your Guidance.
Chris is right there are lots of tutorials online however for anyone who gets to this site here is an example.
Your datagrid would look something like this
<sdk:DataGrid AutoGenerateColumns="False" Padding="15" Height="129" x:Name="dgSOF" Width="1021" ItemsSource="{Binding Path=TestListBinding}" RowHeight="30" BorderBrush="#FFE4E4E4">
<sdk:DataGrid.Columns>
<sdk:DataGridTextColumn Binding="{Binding Path=Something}" Header="Something"/>
<sdk:DataGridTemplateColumn>
<sdk:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Margin="5" Click="Button_Click" Width="100" Content="Click Me!"/>
</DataTemplate>
</sdk:DataGridTemplateColumn.CellTemplate>
</sdk:DataGridTemplateColumn>
</sdk:DataGrid.Columns>
</sdk:DataGrid>
And then the code behind would look something like this
private void Button_Click(object sender, RoutedEventArgs e)
{
string ClickedSomething = ((TestSL.TT)(((System.Windows.Controls.ContentPresenter)(VisualTreeHelper.GetParent(sender as Button))).DataContext)).Something;
SilverlightMessageBoxLibrary.CustomMessage cm = new SilverlightMessageBoxLibrary.CustomMessage("You clicked on " + ClickedSomething, SilverlightMessageBoxLibrary.CustomMessage.MessageType.Error);
cm.Show();
}
This should point you in the right direction
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.