View Issue Details

IDProjectCategoryView StatusLast Update
0002476NoesisGUIC# SDKpublic2023-03-27 12:14
Reporterjphyzic Assigned Tosfernandez  
PrioritynormalSeverityminorReproducibilityhave not tried
Status assignedResolutionopen 
Product Version3.1.4 
Target Version3.2 
Summary0002476: DependencyProperty.AddOwner fails without default value, invalid callback registration
DescriptionCalling DependencyProperty.AddOwner for user-defined DP with PropertyMetadata without specifying default value causes runtime exception.

Calling DependencyProperty.AddOwner for user-defined DP with PropertyMetadata with default value and a property change callback causes parent DP value changed callback to be called with arguments from type that called AddOwner.
Steps To ReproduceSee forum post: https://www.noesisengine.com/forums/viewtopic.php?t=2813

public partial class UserControlA : UserControl
{
    public static readonly DependencyProperty ValueProperty =
        DependencyProperty.Register("Value", typeof(int), typeof(UserControlA), new PropertyMetadata(5, OnValueChanged));
    ...
}

public partial class UserControlB : UserControl
{
    public static readonly DependencyProperty ValueProperty =
        UserControlA.ValueProperty.AddOwner(typeof(UserControlB), new PropertyMetadata(OnValueChanged));
    ...
}

Instantiating both of these classes in XAML causes runtime exception.

Specifying default value in UserControlB DP registration causes UserControlA.OnValueChanged to be called when UserControlB.Value changes.
TagsNo tags attached.
PlatformAny

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2022-12-13 06:54 jphyzic New Issue
2022-12-13 06:57 jphyzic Steps to Reproduce Updated
2022-12-19 13:02 sfernandez Assigned To => sfernandez
2022-12-19 13:02 sfernandez Status new => assigned
2022-12-19 13:02 sfernandez Target Version => 3.2.0
2023-03-27 12:14 jsantos Target Version 3.2.0 => 3.2