Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HasErrors property changed must be raised when errors changed #603

Open
xperiandri opened this issue Apr 24, 2024 · 2 comments
Open

HasErrors property changed must be raised when errors changed #603

xperiandri opened this issue Apr 24, 2024 · 2 comments

Comments

@xperiandri
Copy link

I tried to implement that myself but I don't understand how to determine if errors changed.
You mutate that Map constantly

@xperiandri
Copy link
Author

What I want is to disable the primary dialog button when my model is not valid which is the initial state of my model

<ContentDialog x:Class="Construction.Dialogs.CreateBuildingDialog"
               xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
               xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
               xmlns:local="using:eCierge.Console.Construction.Dialogs"
               xmlns:p="using:eCierge.Console.Construction.Presentation"
               xmlns:ctb="using:CommunityToolkit.WinUI.Behaviors"
               xmlns:i="using:Microsoft.Xaml.Interactivity"
               xmlns:ic="using:Microsoft.Xaml.Interactions.Core"

               xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
               xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
               mc:Ignorable="d"

               Title="Create building"
               Style="{StaticResource ScrollableContentDialogStyle}"
               MinWidth="400"
               MinHeight="300"
               PrimaryButtonText="Create"
               PrimaryButtonCommand="{x:Bind ViewModel.CreateBuildingCommand, Mode=OneWay}"
               IsPrimaryButtonEnabled="{x:Bind ViewModel.HasErrors, Converter={StaticResource BoolNegationConverter}, Mode=OneWay}"
               SecondaryButtonText="Cancel"
               SecondaryButtonCommand="{x:Bind ViewModel.CancelCommand, Mode=OneWay}">

  <i:Interaction.Behaviors>
    <ic:EventTriggerBehavior EventName="{x:Bind CloseDialogEventName}" SourceObject="{x:Bind DataContext, Mode=OneWay}">
      <ic:CallMethodAction MethodName="{x:Bind HideMethodName}" TargetObject="{x:Bind}" />
    </ic:EventTriggerBehavior>
  </i:Interaction.Behaviors>

  <p:CreateBuildingPage MinWidth="400" />
</ContentDialog>

@xperiandri
Copy link
Author

The fix is in my for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant