It seems x:Array isn't implemented (Unknown type 'Array')?
Hi there. After several weeks of learning WPF from scratch I'm finally starting to integrate noesisgui to my game(c++/smfl/opengl), and it seems to be working perfectly now.
Now I run into a little "problem", the "play" and "pause" button in the screenshot are actually RadioButtons, and the code below is how I've done it in WPF.
But since x:Array is not implemented in NoesisGUI yet, I just hard coded them(since there are only 2 buttons), but I'm wondering is there a better way to do this? Thanks a lot!
Now I run into a little "problem", the "play" and "pause" button in the screenshot are actually RadioButtons, and the code below is how I've done it in WPF.

Code: Select all
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="img" Property="Source" Value="{Binding Tag[1], RelativeSource={RelativeSource TemplatedParent}}" />
</Trigger>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="img" Property="Source" Value="{Binding Tag[2], RelativeSource={RelativeSource TemplatedParent}}" />
</Trigger>
</ControlTemplate.Triggers>
<RadioButton.Tag>
<x:Array Type="ImageSource">
<BitmapImage UriSource="../Images/btnSmallPlay0001.png" />
<BitmapImage UriSource="../Images/btnSmallPlay0002.png" />
<BitmapImage UriSource="../Images/btnSmallPlay0003.png" />
</x:Array>
</RadioButton.Tag>
-
-
sfernandez
Site Admin
- Posts: 2058
- Joined:
Re: It seems x:Array isn't implemented (Unknown type 'Array')?
Support for generic arrays has been asked in the past, #668, but is not implemented.
There are some alternatives, for example, you can provide your own specific collection:
Or changing the template to use resources instead of bindings:
Could that work for you?
There are some alternatives, for example, you can provide your own specific collection:
Code: Select all
class ImageSourceCollection: public Noesis::FreezableCollection<ImageSource>
{
NS_IMPLEMENT_INLINE_REFLECTION_(ImageSourceCollection, Noesis::BaseFreezableCollection, "YourNamespace.ImageSourceCollection")
};
...
Noesis::RegisterComponent<ImageSourceCollection>();
Code: Select all
<RadioButton.Tag>
<local:ImageSourceCollection>
<BitmapImage UriSource="../Images/btnSmallPlay0001.png" />
<BitmapImage UriSource="../Images/btnSmallPlay0002.png" />
<BitmapImage UriSource="../Images/btnSmallPlay0003.png" />
</local:ImageSourceCollection>
</RadioButton.Tag>
Code: Select all
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="img" Property="Source" Value="{DynamicResource imgOver}"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="img" Property="Source" Value="{DynamicResource imgPress}"/>
</Trigger>
</ControlTemplate.Triggers>
Code: Select all
<RadioButton.Resources>
<BitmapImage x:Key="imgNormal" UriSource="Images/btn1-normal.png"/>
<BitmapImage x:Key="imgOver" UriSource="Images/btn1-over.png"/>
<BitmapImage x:Key="imgPress" UriSource="Images/btn1-press.png"/>
</RadioButton.Resources>
Re: It seems x:Array isn't implemented (Unknown type 'Array')?
Wow, thanks for the quick respond. I think this is a much better solution then my current hard-coded one.
-
-
sfernandez
Site Admin
- Posts: 2058
- Joined:
Re: It seems x:Array isn't implemented (Unknown type 'Array')?
Great, I'll mark this post as solved.
Who is online
Users browsing this forum: No registered users and 0 guests