Enum Dependency Property
Posted: 29 Jun 2024, 22:57
hi and thanks inAdvance:
i created a user control with some dependency properties.
in the end i want this line to work:
i use this enum:
also declared and defined in hpp and cpp as static.
this is the relevent part in my user control xaml:
i tested my converter and i works.
i made other dependency properties bool type and it also work.
the error i get is:
MainWindow.xaml(64,80): Cannot set value for property 'BasicAssistantScreen.SettingsUserControl.LowerButtonTypeProperty', 'local:LowerButtonType.PowerButton' is not a valid value
i tried also this:
i try to find what i do wrong.
i am pretty new in noesis so maybe some funny mistake.
thanks again
i created a user control with some dependency properties.
in the end i want this line to work:
Code: Select all
<local:SettingsUserControl Name="SettingModule" Background="White" Grid.Row="1" Grid.Column="0" Margin="10"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch" [u][b]LowerButtonTypeProperty="local:LowerButtonType.PowerButton">[/b][/u]Code: Select all
namespace XXX
{
enum class LowerButtonType {
PowerButton,
BackButton,
NumButtons
};
}
NS_IMPLEMENT_INLINE_REFLECTION_ENUM(XXX::LowerButtonType, "XXX.LowerButtonType")
{
NsVal("PowerButton", XXX::LowerButtonType::PowerButton);
NsVal("BackButton", XXX::LowerButtonType::BackButton);
}
register the property:
NS_IMPLEMENT_INLINE_REFLECTION(SettingsUserControl, UserControl, "XXX.SettingsUserControl")
{
Noesis::UIElementData* data = NsMeta<Noesis::UIElementData>(Noesis::TypeOf<SelfClass>());
data->RegisterProperty<LowerButtonType>(lower_button_type_property, "LowerButtonTypeProperty", Noesis::PropertyMetadata::Create(LowerButtonType(LowerButtonType::BackButton)));
}
this is the relevent part in my user control xaml:
Code: Select all
<Image Source="{Binding LowerButtonTypeProperty, Converter={StaticResource ImageConverter}, RelativeSource={RelativeSource AncestorType=UserControl}}">
i made other dependency properties bool type and it also work.
the error i get is:
MainWindow.xaml(64,80): Cannot set value for property 'BasicAssistantScreen.SettingsUserControl.LowerButtonTypeProperty', 'local:LowerButtonType.PowerButton' is not a valid value
i tried also this:
Code: Select all
<local:SettingsUserControl Name="SettingModule" Background="White" Grid.Row="1" Grid.Column="0" Margin="10"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch" LowerButtonTypeProperty="PowerButton">i am pretty new in noesis so maybe some funny mistake.
thanks again