Page 1 of 1

[Unity] Binding to struct type

Posted: 28 Jul 2014, 19:44
by Weltista

I was wondering if there is a way to bind View to a struct type. Say I have the class that contains struct type:
  public SpaceShip myShip;

public class SpaceShip: Noesis.BaseComponent {

	private Damage_Resist _current_Resist;
	public Damage_Resist current_Resist {
		get { return _current_Resist; }
		set	{
			if (_current_Resist != value) {
				_current_Resist = value;

public struct Damage_Resist { 
	public float resist_Kinet;
	public float resist_Gravi;
	public Damage_Resist (float r_kin, float r_gravi) {
		resist_Kinet = r_kin;
		resist_Gravi = r_gravi;
After setting DataContext to myShip, is it possible to reference parameters it in xaml like: Text="{Binding current_Resist.resist_Kinet } ?

Re: [Unity] Binding to struct type

Posted: 29 Jul 2014, 03:30
by sfernandez
Sorry but we only support to bind to properties (not even fields) of classes that at least inherit from Noesis.BaseComponent and have the [Noesis.Extended] attribute.

Many questions have been asked about this constraints, and we are working on ways to improve and even remove them at all. We expect to have a better extensibility API in a future release.

Re: [Unity] Binding to struct type

Posted: 29 Jul 2014, 15:09
by jsantos
As a workaround if you convert Damage_Resist to a class, inherit from Noesis.BaseComponent, and implement each field as property you should be able to bind from the XAML the way you expressed: Text="{Binding current_Resist.resist_Kinet }