postIt #2
1 changed files with 9 additions and 6 deletions
fixes the button access
commit
13d985e4e3
|
|
@ -5,8 +5,7 @@
|
||||||
x:Class="PostIt.Views.SettingsPage"
|
x:Class="PostIt.Views.SettingsPage"
|
||||||
xmlns:vm="using:PostIt.ViewModels"
|
xmlns:vm="using:PostIt.ViewModels"
|
||||||
x:DataType="vm:Settings"
|
x:DataType="vm:Settings"
|
||||||
Width="400"
|
>
|
||||||
Height="300">
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
|
|
@ -47,12 +46,16 @@
|
||||||
<TextBlock Grid.Row="10" Text="Dark mode"/>
|
<TextBlock Grid.Row="10" Text="Dark mode"/>
|
||||||
<CheckBox Grid.Row="11" x:Name="DarkModeCheckBox" IsChecked="{Binding DarkMode, Mode=TwoWay}"/>
|
<CheckBox Grid.Row="11" x:Name="DarkModeCheckBox" IsChecked="{Binding DarkMode, Mode=TwoWay}"/>
|
||||||
|
|
||||||
<!-- Sauver: bound to the SaveCommand on the Settings VM, with
|
<!-- Sauver: bound to the Save RelayCommand on the Settings
|
||||||
IsEnabled driven by the inverse of IsDirty so the button
|
VM. The source generator emits an ICommand property whose
|
||||||
auto-disables when there's nothing to persist. -->
|
name matches the source method exactly (no "Command"
|
||||||
|
suffix is added), so we bind {Binding Save} here. See
|
||||||
|
AGENTS.md "Avalonia + CommunityToolkit.Mvvm : conventions
|
||||||
|
de binding pour [RelayCommand]" for the full rationale.
|
||||||
|
IsEnabled tracks IsDirty so the button auto-disables
|
||||||
|
when there's nothing to persist. -->
|
||||||
<Button Grid.Row="12" Content="Sauver"
|
<Button Grid.Row="12" Content="Sauver"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
Margin="0,12,0,0"
|
|
||||||
Command="{Binding Save}"
|
Command="{Binding Save}"
|
||||||
IsEnabled="{Binding IsDirty}"/>
|
IsEnabled="{Binding IsDirty}"/>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue