<local:NumericText x:Name="sfNumericTextBox"
MaximumNumberDecimalDigits="0"
HeightRequest="50"
Minimum="0"
Maximum="100"
Value="52"
AllowNull="false"
FormatString="n"/> |
<StackLayout Margin="0,40,0,0" Orientation="Vertical">
<StackLayout.BindingContext> <local:ViewModel /> </StackLayout.BindingContext> <numericTextBox:SfNumericTextBox x:Name="textBox" Value="{Binding Cycle, Mode=TwoWay}" FormatString="n" MaximumNumberDecimalDigits="0" Maximum="255" WidthRequest="400" Minimum="1" HorizontalOptions="CenterAndExpand" /> <Label Text="{Binding Source={x:Reference textBox}, Path= Value}" BackgroundColor="Gray" TextColor="Red" /> <Label Text="{Binding Cycle} " BackgroundColor="Gray" TextColor="Red" /> </StackLayout> |
public class ViewModel: INotifyPropertyChanged
{ public ViewModel() { } private double cycle = 0; public event PropertyChangedEventHandler PropertyChanged; public double Cycle { get { return cycle; } set { cycle = value; RaisePropertyChanged("Cycle"); } } void RaisePropertyChanged(string name) { if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(name)); } } } |