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

Questions about ObservableValidator in MVVM Toolkit Sample App #108

Open
JesseLiberty opened this issue Jan 3, 2023 · 0 comments
Open

Comments

@JesseLiberty
Copy link

In the MVVM Toolkit Sample App there is a sample of the ObservableValidator. I have a couple questions (thank you in advance for reading through all this)
 

public ValidationFormWidgetViewModel(IDialogService dialogService)
{
     DialogService = dialogService;
}

 
I assume the IDialogService is being passed in via DI - is that correct? Is this the preferred way to invoke a dialog from the VM?
 
There is this declaration:
 
public event EventHandler? FormSubmissionCompleted;
 
Later, if there are no errors it is invoked with:
 
FormSubmissionCompleted?.Invoke(this, EventArgs.Empty);
 
Can you explain that construct? It does not show what gets called when you invoke that. The XAML on the other hand has 
 

<Grid>
        <muxc:InfoBar
            x:Name="SuccessInfoBar"
            Title="Success"
            Message="The form was filled in correctly."
            Severity="Success">
            <interactivity:Interaction.Behaviors>
                <interactions:EventTriggerBehavior EventName="FormSubmissionCompleted" SourceObject="{x:Bind ViewModel}">
                    <interactions:ChangePropertyAction
                        PropertyName="IsOpen"
                        TargetObject="{x:Bind SuccessInfoBar}"
                        Value="True" />
                    <interactions:ChangePropertyAction
                        PropertyName="IsOpen"
                        TargetObject="{x:Bind FailureInfoBar}"
                        Value="False" />
                </interactions:EventTriggerBehavior>
            </interactivity:Interaction.Behaviors>
        </muxc:InfoBar>

 
So I'm guessing that when FormSubmissionCompleted is invoked it tiggers the display of the SuccessInfoBar??
 
Is EventTriggerBehavior documented anywhere? I can't find it.
 
Also what is with this construct: 
 
TargetObject="{x:Bind SuccessInfoBar}"
 
Is that the (new?) (preferred?) way of handling a binding?

Unfortunately the namespaces are not shown as far as I can tell. Is there a complete sample that has the complete contents of all the files for ObservableValidator?

Thanks!

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