R
R
Ruslan2014-12-03 17:01:32
C++ / C#
Ruslan, 2014-12-03 17:01:32

Can XAML for Xamarin Forms use calculations when binding a model to a view?

Hello!
Is it possible, and if so how, to use Boolean expressions in a XAML view in Xamarin Forms?
The essence of the task is as follows: There is a button and a process progress bar. When you press the button, the process starts, which lasts for some time. before starting the process, make the button invisible and the progress indicator visible. after the process is completed, the visibility status is changed to the opposite.
I have the following code in the xaml description of the view:

<Button x:Name="SaveSettings" Text="Сохранить и проверить" Command="{Binding SaveSettings}"
IsVisible="{Binding !Busy}" />
<ActivityIndicator IsVisible="{Binding Busy}" IsRunning="{Binding Busy}" />

the above code is not working properly.
The Busy property is responsible for visibility. But when the button is visible, the progress bar should not be visible. I also want to get by with one property for this.
You can also make a second property, for example, NotBusy, which will have an inverted value and bind it to the button.
But still I want to get by with one property in the view model. Is it possible to do so?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rasim Keita, 2014-12-15
@keyros

You can use converters
msdn.microsoft.com/en-us/library/system.windows.da...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question