[Unity] Binding to struct type
Hi,
I was wondering if there is a way to bind View to a struct type. Say I have the class that contains struct type:
After setting DataContext to myShip, is it possible to reference parameters it in xaml like: Text="{Binding current_Resist.resist_Kinet } ?
I was wondering if there is a way to bind View to a struct type. Say I have the class that contains struct type:
Code: Select all
public SpaceShip myShip;
[Noesis.Extended]
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;
NotifyPropertyChanged("current_Resist");
}
}
}
}
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;
}
-
-
sfernandez
Site Admin
- Posts: 3197
- Joined:
Re: [Unity] Binding to struct type
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.
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
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 }
Who is online
Users browsing this forum: No registered users and 8 guests