- Andreas Schooll
- Posts: 25
- Joined:
Creating objects like Noesis.Button directly within C#
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
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
-
sfernandez
Site Admin
- Posts: 3154
- Joined:
Re: Creating objects like Noesis.Button directly within C#
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.
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
- Posts: 25
- Joined:
Re: Creating objects like Noesis.Button directly within C#
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.
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.
-
sfernandez
Site Admin
- Posts: 3154
- Joined:
Re: Creating objects like Noesis.Button directly within C#
That is a relief
Who is online
Users browsing this forum: No registered users and 3 guests