This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Button Text="Click Me" Command="{Binding ShowMessageCommand}" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CommandViewModel | |
{ | |
public ICommand ShowMessageCommand { get; } | |
public CommandViewModel() | |
{ | |
ShowMessageCommand = new Command(() => | |
{ | |
Application.Current.MainPage.DisplayAlert("Hello", "Command executed!", "OK"); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Label Text="{Binding ProductName, Mode=OneTime}" FontSize="18"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Label Text="{Binding Name, Mode=TwoWay}" FontSize="24"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Label Text="{Binding Name, Mode=OneWay}" FontSize="24"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Label Text="Status" TextColor="{Binding IsActive, Converter={StaticResource BoolToColorConverter}}"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BoolToColorConverter : IValueConverter | |
{ | |
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | |
{ | |
return (bool)value ? Colors.Green : Colors.Red; | |
} | |
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | |
{ | |
throw new NotImplementedException(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | |
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | |
x:Class="MyApp.MainPage"> | |
<ContentPage.BindingContext> | |
<local:UserViewModel /> | |
</ContentPage.BindingContext> | |
<StackLayout Padding="20"> | |
<Label Text="{Binding Name}" FontSize="24"/> | |
<Entry Text="{Binding Name, Mode=TwoWay}" Placeholder="Enter your name"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class UserViewModel : INotifyPropertyChanged | |
{ | |
private string name; | |
public string Name | |
{ | |
get => name; | |
set | |
{ | |
if (name != value) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Stage 1 | |
FROM node:17-alpine as builder | |
WORKDIR /app | |
COPY package*.json . | |
COPY yarn*.lock . | |
RUN yarn install | |
COPY . . | |
RUN yarn build | |
#Stage 2 |
NewerOlder