[Unity] Observablecollection problem.
Posted: 12 Sep 2016, 19:28
Hi,
I'm new here and actually new in whole WPF world but I think I'm getting hang of it quite nicely but now I've faced small problem which I just can't solve. No idea if it's actually a unity's problem or not but AFAIK, my code and xaml should be correct..
I have this in my code, it's more complicated in my actual file but I simplified it as much as possible.
and this is how combobox looks like,

the actual code takes items from a enumeration like this
and result is exactly same, correct amount of items but names are "namespace.class"
I'm new here and actually new in whole WPF world but I think I'm getting hang of it quite nicely but now I've faced small problem which I just can't solve. No idea if it's actually a unity's problem or not but AFAIK, my code and xaml should be correct..
I have this in my code, it's more complicated in my actual file but I simplified it as much as possible.
Code: Select all
public class CokEditorDataModel : BaseComponent
{
public class ArenaStyle
{
public string style { get; set; }
}
public class ArenaData
{
public ObservableCollection<ArenaStyle> arenastyle { get; private set; }
public ArenaData()
{
arenastyle = new ObservableCollection<ArenaStyle>()
{
new ArenaStyle() { style = "test"},
new ArenaStyle(){ style = "test2"},
new ArenaStyle(){ style = "test3"}
};
}
}
}
}

the actual code takes items from a enumeration like this
Code: Select all
foreach (Enumerations.ArenaStyle arenaStyle in Enum.GetValues(typeof(Enumerations.ArenaStyle)))
{
ArenaStyles.Add(new ArenaStyle(arenaStyle));
}