Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

interactivity EventTrigger called everytime I load window

$
0
0

I have a window with this code on the xaml

<Button Margin="5" Content="Check" Command="{Binding CheckForUpdatesCommand}" />

...

<i:EventTrigger EventName="SoftwareOutOfDateEvent" SourceObject="{Binding}"><view:InvokeDelegateCommandAction Command="{x:Static view:Commands.ShowMessageOutOfDateVersionCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=InvokeParameter}" /></i:EventTrigger>

Inside my ViewModel , the CheckForUpdatesCommand raise an event in this way

public event EventHandler SoftwareUpToDateEvent;

RootDispatcher.Invoke((Action)delegate()
{
	if (SoftwareUpToDateEvent != null)
		SoftwareUpToDateEvent.Invoke(this, args);
});

Now the problem is that everytime I close and open the window, event add again and again, so the messagebox appears x times I have open my window in the application life.

What I can do to ?


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>