user2380522
user2380522

Reputation: 21

Win Phone 8 WP8 Creating Dynamic Controls at runtime

I need to be able to create dynamic controls at runtime - textblocks, buttons to be specific. I have tried this: dim b as button = new button b.content="test"

The code does not error but also does not produce a button either. Simple I know but for Wp8 it's quite difficult for me. Thanks

Upvotes: 2

Views: 690

Answers (1)

Kenneth
Kenneth

Reputation: 28737

You still need to add the button to your page. Try this:

Xaml

<ContentControl x:Name="container">

</ContentControl>

Code

Dim b as New Button With { .Content = "test"}
container.Content = b

Upvotes: 2

Related Questions