Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 89864

BindableProperty does not notify when its property is set

$
0
0

Hi all,

I am developing my own DynamicGrid and I have added to it BindableProperty:

        public static readonly BindableProperty DynamicRowDefinitionProperty =
            BindableProperty.Create( // Or BindableProperty.CreateAttached it does not matter
                "DynamicRowDefinition",
                typeof(RowDefinition),
                typeof(DynamicGrid),
                defaultValue: null,
                defaultValueCreator: bindable =>
                {
                    var rowDef = new RowDefinition();
                    rowDef.SizeChanged += ((DynamicGrid)bindable).OnDefinitionChanged;
                    return rowDef;
                },
                propertyChanged: OnDynamicRowDefinitionPropertyChanged);

        public static void OnDynamicRowDefinitionPropertyChanged(BindableObject bindable, object oldValue, object newValue)
        {
            if (oldValue != newValue)
            {
            }
        }

        public void OnDefinitionChanged(object bindable, EventArgs newValue)
        {
            Console.WriteLine("OnDefinitionChanged");
        }

        public RowDefinition DynamicRowDefinition
        {
            get { return (RowDefinition)GetValue(DynamicRowDefinitionProperty); }
            protected set { SetValue(DynamicRowDefinitionProperty, value); }
        }

, but when I try to set Height of DynamicRowDefinition it does not set Height :

<utilscontrols:DynamicGrid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
    <utilscontrols:DynamicGrid.DynamicRowDefinition
                Height="20" />
     <!-- ... -->
</utilscontrols:DynamicGrid>

But by some reason I do not receive OnDefinitionChanged when Height is set to value "20"

What did I wrong ?


Viewing all articles
Browse latest Browse all 89864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>