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

How to binding property in a behavior?

$
0
0

In xaml file:

<Picker 
        x:Name="picker_cadastronotificacao_tipotelefone" 
        Title="{x:Static local:AppResources.picker_cadastronotificacao_tipotelefone}"
         Style="{StaticResource Picker}"
         SelectedItem="{Binding TipoTelefoneSelecionado}">
        <Picker.Items>
                  <x:String>Celular</x:String>
                  <x:String>Telefone Fixo</x:String>
         </Picker.Items>
</Picker>

<Entry 
      x:Name="entry_cadastronotificacao_telefone" 
      Placeholder="{x:Static local:AppResources.entry_cadastronotificacao_telefone}" 
      Style="{StaticResource EntradasTexto}" 
      Text="{Binding Telefone}"
      Keyboard="Telephone"
      IsEnabled="{Binding HabilitarCampoTelefone}">

      <Entry.Behaviors>
             <behavior:MaskBehavior Mascara="{Binding MascaraTelefone}"/>
      </Entry.Behaviors>
</Entry>

In view model:

if (TipoTelefoneSelecionado == "Telefone Fixo")
      MascaraTelefone = "(XX) XXXX - XXXX";
else if(TipoTelefoneSelecionado == Celular)
      MascaraTelefone = "(XX) XXXXX - XXXX";

Error: No property, bindable property, or event found for 'Mascara', or mismatching type between value and property.


Viewing all articles
Browse latest Browse all 89864

Trending Articles



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