Место общения программистов C#
Anonymous
Net maui isenabled сбросить редактируемое значение
Сообщение
Anonymous » 21 май 2024, 23:30
Странное поведение
Я заполняю свойства модели представления (одно из них блокирует поля)
Код: Выделить всё
public partial class ConfigurationViewModel : ObservableObject
{
[ObservableProperty]
private WDXConfiguration? _configuration;
public ConfigurationViewModel(WDXConfiguration? Configuration,bool newFirstTime)
{
_configuration = Configuration;
FirstTime = newFirstTime;
}
[ObservableProperty]
private bool _firstTime;
}
Код: Выделить всё
public partial class WDXConfiguration : ObservableObject
{
public WDXConfiguration()
{
}
[ObservableProperty]
private string _codFiscale;
[ObservableProperty]
public bool Enabled{ get; set; }
public void Load()
{
//test
CodFiscale="ABCDE";
Enabled=false;
}
}
Код: Выделить всё
public ConfigurationPage(ConfigurationViewModel model)
{
InitializeComponent();
BindingContext = model;
//also tried to unlock/set/lock
if (model.Configuration != null)
{
CodFisc.IsEnabled = true;
CodFisc.Text = model.Configuration.CodFiscale;
CodFisc.IsEnabled = false; //
Подробнее здесь: [url]https://stackoverflow.com/questions/78513952/net-maui-isenabled-reset-edit-value[/url]
1716323423
Anonymous
Странное поведение Я заполняю свойства модели представления (одно из них блокирует поля) [code] public partial class ConfigurationViewModel : ObservableObject { [ObservableProperty] private WDXConfiguration? _configuration; public ConfigurationViewModel(WDXConfiguration? Configuration,bool newFirstTime) { _configuration = Configuration; FirstTime = newFirstTime; } [ObservableProperty] private bool _firstTime; } [/code] [code] public partial class WDXConfiguration : ObservableObject { public WDXConfiguration() { } [ObservableProperty] private string _codFiscale; [ObservableProperty] public bool Enabled{ get; set; } public void Load() { //test CodFiscale="ABCDE"; Enabled=false; } } [/code] [code]public ConfigurationPage(ConfigurationViewModel model) { InitializeComponent(); BindingContext = model; //also tried to unlock/set/lock if (model.Configuration != null) { CodFisc.IsEnabled = true; CodFisc.Text = model.Configuration.CodFiscale; CodFisc.IsEnabled = false; // Подробнее здесь: [url]https://stackoverflow.com/questions/78513952/net-maui-isenabled-reset-edit-value[/url]