Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public ObservableCollection<NumberViewModel> Nummer { get; private set; } = new ObservableCollection<NumberViewModel>();
- private int _currentNumber;
- public int current
- {
- get
- {
- return _currentNumber;
- }
- set
- {
- _currentNumber = value;
- OnPropertyChanged();
- }
- }
- public ICommand CountUpCommand { get; private set; }
- public ICommand DelCommand { get; private set; }
- Number Zahl = new Number();
- public CounterViewModel()
- {
- CountUpCommand = new Command(CountUp);
- DelCommand = new Command(SetZero);
- }
- public void SetZero()
- {
- current = 0;
- Nummer.Add(new NumberViewModel { Num = current});
- }
- public void CountUp()
- {
- current = current + 1;
- Nummer.Add(new NumberViewModel { Num = current });
- }
- <StackLayout>
- <Button Text="+1" Command="{Binding CountUpCommand}" x:Name="plusOne" />
- <Button Text="DEL" Command="{Binding DelCommand}" />
- </StackLayout>
- <Label Text="--------------" />
- <StackLayout>
- <ListView ItemsSource="{Binding Nummer}">
- <ListView.ItemTemplate>
- <DataTemplate>
- <TextCell
- Text="{Binding Num}"
- x:Name="ElNr"
- />
- </DataTemplate>
- </ListView.ItemTemplate>
- </ListView>
- </StackLayout>
Add Comment
Please, Sign In to add comment