我在Task的入口处有一个Task,将EditorText设置为空字符串。我正在使用FreshMvvm。您能否解释为什么在Task DecreaseDate EditorText条目中设置了条目?
以下内容在DayLogPageModel.cs中
async Task DecreaseDate()
{
_dayLogs.SetLog(_logDate.ConvertToIntShort(), EditorText);
_logDate.AddDays(-1);
LogDateString = _logDate.ConvertToStrShort();
EditorText = _dayLogs.GetLog(_logDate.ConvertToIntShort());
}
private string _editorText;
public String EditorText
{
get => _editorText;
set
{
_editorText = value;
RaisePropertyChanged("EditorText");
}
}
这是DayLogPage.xaml
?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:workoutDiaryGridDesignPage1"
x:Class="workoutDiaryGridDesignPage1.DayLogPage">
<ContentPage.Content>
<Grid x:Name="DayLogTrialGrid" RowSpacing="1" ColumnSpacing="1">
<Grid.RowDefinitions>
<RowDefinition Height="100" />
<RowDefinition Height="200" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Editor x:Name="DayLogEditor" Text="{Binding EditorText, Mode=TwoWay}"
Grid.Row="1" Grid.Column="0"
FontSize="Large" HorizontalOptions="Center" VerticalOptions="Center"
Keyboard="Chat" HeightRequest="100" WidthRequest="500"/>
</Grid>
</ContentPage.Content>
</ContentPage>