L
L
LuVairo2021-11-05 15:18:41
WPF
LuVairo, 2021-11-05 15:18:41

How to minimize window within mvvm pattern using Microsoft.Xaml.Behaviors.Wpf?

Hello! I have the following code which I am trying to minimize the window

<Button Style="{StaticResource HideButtonStyle}" 
              HorizontalAlignment="Right" Margin="0 0 43 0">
    <inter:Interaction.Triggers>
        <inter:EventTrigger EventName="Click">
            <inter:ChangePropertyAction PropertyName="WindowState"
                TargetObject="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}"
                Value="WindowState.Minimized"
            />
        </inter:EventTrigger>
    </inter:Interaction.Triggers>
</Button>

The error is that you cannot set the WindowState property to a value of type "WindowState.Minimized" (recognized as a string and I understand this). How can it be done then? Thanks in advance

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question