Andreas Schooll
Topic Author
Posts: 25
Joined: 30 Sep 2013, 16:58

Creating objects like Noesis.Button directly within C#

15 Oct 2013, 15:50

Hi,

we have a few cases in our project where we directly create objects like a Noesis Button or StackPanel directly in our C# code.

The code looks something like this:
//
Button objButton = new Button().

objButton.SetContent("text bla bla");
//

With 1.0.4 this worked without problems. Unfortunately with 1.1.0 there is an access violation occuring inside the called functions like SetContent(). As far as i have seen there is a new default constructor added in the proxies like Button.cs. And i guess it creates the object in the wrong address space (outside the dll) if we do it as we did?

What is the correct approach to create a Noesis UiElement within c# code?

best regards,
Andreas
 
User avatar
sfernandez
Site Admin
Posts: 1918
Joined: 22 Dec 2011, 19:20

Re: Creating objects like Noesis.Button directly within C#

15 Oct 2013, 16:50

The code you posted is the right way to create a Button programmatically. Unfortunately I was unable to reproduce this crash.

Would you mind posting here a simple xaml and script that causes you an access violation so we can try to track down the bug?

Thanks for your collaboration.
 
Andreas Schooll
Topic Author
Posts: 25
Joined: 30 Sep 2013, 16:58

Re: Creating objects like Noesis.Button directly within C#

15 Oct 2013, 17:54

We found the problem that was causing this behaviour.

We had some UserControls that where not using the new conventions and still had contructors as described in the 1.0.4 UserControl Tutorial. After creating such a user control we could not create / access manually created Ui elements.

Thanks for your help.
 
User avatar
sfernandez
Site Admin
Posts: 1918
Joined: 22 Dec 2011, 19:20

Re: Creating objects like Noesis.Button directly within C#

15 Oct 2013, 18:03

That is a relief :D

Who is online

Users browsing this forum: No registered users and 1 guest