I wanted to ask, if it's possible to add event into definition of object. I know how to add event to object when you define it 'separately', not 'nested' like this. But I'd like to use this kind of syntax. Thank you.
StackPanel sp = new StackPanel()
{
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
Children =
{
new Button
{
Content = "Click Here",
// !!! NEED ADD CLICK EVENT HERE !!!
}
}
};