tags:

views:

8

answers:

1

Hi, I am programming a user control and I am adding buttons to the window using C# code. I read that i can create a Xaml document and then using the xamlReader load it to a Window.

Both approaches work but witch one to you think will have the best performance? or witch one will you recomend

Thanks !!!

A: 

My gut feeling tells me that the performance of reading the xaml and loading the contents into the window will be a little bit slower then using code.

My explanation of it: - The xaml needs to be loaded/readed from disk and decompiled into objects. - when using code to construct the objects you can skip the loading from disk part and the rest will be the same.

But I think it is better to look at what you need. If you would like to design the buttons it is much easier to create the xaml and load that in your window than constructing the control in code.

So it is up to you to see what solution fits best for your project.

Wouter Janssens - Xelos bvba