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

Get Binding Path from View

$
0
0

There is a possible way to get the path of the Binding?

    <local:TestBasePage xmlns="http://xamarin.com/schemas/2014/forms"
                 xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                 xmlns:xlabs="clr-namespace:XLabs.Forms.Controls;assembly=XLabs.Forms"
                 BackgroundColor="White"
                 xmlns:local="clr-namespace:Test;assembly=Test"
                 >
     <StackLayout>
            <local:Switch
                                BackgroundColor="Transparent"
                                VerticalOptions = "CenterAndExpand"
                                HorizontalOptions="FillAndExpand"

                                Grid.Row="0" Grid.Column="0"
                                IsToggled="{Binding Car.IsBlue}"
                                PropertyChanged="VisualElementsBindingContextChanged"
                            />

        </StackLayout>
    </local:TestBasePage> 


void VisualElementsBindingContextChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            var switch = sender as Switch;

            //there take the path of the swtch property   ,, path = "Car.IsBlue"
            string path = switch.IsToggled.BindingContext.ToString();   // or something like that
        }

Is that possible??


Viewing all articles
Browse latest Browse all 91519

Trending Articles



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