locked
Triggering binding in other binding RRS feed

  • Question

  • User389768 posted

    Hi guys , I have a picker and button .I want to set button visibilty after picker selected. Seems like OnSelectedChanged action of picker can not be bind to a command . i have already binding for SelectedItem property so i thought i can use this for make button visible. It is working but there is a problem : Button visibilty doesnt changing after picker first selection time. After 1. selection if i select other thing on picker it is changing.

    This is my code : // MVVM part

    public bool IsLevelSelected {
            get { return _isLevelSelected; }
            set
            {
                _isLevelSelected = value;
                OnPropertyChanged(nameof(IsLevelSelected));
            }
    
                 }
        public string SelectedLevel
        {
            get
            {
                return _selectedLevel;
            }
            set
            {
                IsLevelSelected = true;
                _selectedLevel = value;
                OnPropertyChanged(nameof(SelectedLevel));
    
            }
        }
    

    //XAML

    CornerRadius="25" CommandParameter="{Binding SelectedLevel}"

    Monday, November 11, 2019 7:14 PM

Answers

  • User369978 posted

    Try to update Xamarin.Forms package to the latest in Forms and specific project to see if problem persists.

    PS : I test on XF 4.2.0.709249 .

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Wednesday, November 13, 2019 7:10 AM
  • User389768 posted

    @ColeX said: Try to update Xamarin.Forms package to the latest in Forms and specific project to see if problem persists.

    PS : I test on XF 4.2.0.709249 .

    I updated *every * package installed , it worked. THANK YOU

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Wednesday, November 13, 2019 12:40 PM

All replies

  • User53115 posted

    So your problem is that the Button Text binding isn't updating when you change the Picker SelectedItem? Or are you expecting the IsLevelSelected property to change to false again at some point?

    Monday, November 11, 2019 7:41 PM
  • User389768 posted

    @JoeManke said: So your problem is that the Button Text binding isn't updating when you change the Picker SelectedItem? Or are you expecting the IsLevelSelected property to change to false again at some point?

    I want To set "IsLevelSelected" as "true" when a level selected from picker.

    Monday, November 11, 2019 7:46 PM
  • User389768 posted

    https://files.fm/u/y4huab24

    This is screen record of problem . I want to make it visible at first selection.

    Monday, November 11, 2019 7:56 PM
  • User53115 posted

    Strange. If you put a breakpoint in the SelectedLevel setter, is it hit the first time?

    Monday, November 11, 2019 9:28 PM
  • User389768 posted

    Yes it does.

    Tuesday, November 12, 2019 7:19 AM
  • User369978 posted

    Same code works perfectly on my side , what's the Forms version did you test on ?

    Tuesday, November 12, 2019 9:34 AM
  • User389768 posted

    @ColeX said: Same code works perfectly on my side , what's the Forms version did you test on ?

    <PackageReference Include="Xamarin.Forms" Version="4.1.0.555618" />
    <PackageReference Include="Xamarin.Essentials" Version="1.1.0" />
    
    Tuesday, November 12, 2019 5:05 PM
  • User369978 posted

    Try to update Xamarin.Forms package to the latest in Forms and specific project to see if problem persists.

    PS : I test on XF 4.2.0.709249 .

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Wednesday, November 13, 2019 7:10 AM
  • User389768 posted

    @ColeX said: Try to update Xamarin.Forms package to the latest in Forms and specific project to see if problem persists.

    PS : I test on XF 4.2.0.709249 .

    I updated *every * package installed , it worked. THANK YOU

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Wednesday, November 13, 2019 12:40 PM