Give a name and declare event handler of a button Created at run time with C# XamlReader
问题 I am working on a project in C# and WPF that dynamically creates a grid layout that has some text, an image, and a button. I create many of these grids, and add them to a stack panel. I create this grid using the XamlReader.Create() function. Here is the whole code, and i apologize that the Xaml code is so long string xaml = "<Grid Height='92' Margin='0,10,0,0' xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'>"+ "<Grid.Background>"+ "<LinearGradientBrush EndPoint='0.5,1'