I would create a base window class and then have all of your Windows inherit from it. Once you have the new base class and you add a window or are updating existing windows to inherit from it, you have to also change the Xaml to reflect the new base class. So, here is an example base Window class.
public class WindowBase : Window
{
public WindowBase()
{
//initialize timer and hook loaded event
this.Loaded += WindowBase_Loaded;
}
void WindowBase_Loaded(object sender, RoutedEventArgs e)
{
}
}
Here would be a window inheriting from it.
public partial class MainWindow : WindowBase
{
public MainWindow()
{
InitializeComponent();
}
}
and then here the Xaml for the same window
<local:WindowBase x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WpfApplication1"
Title="MainWindow" Height="350" Width="525">
<Grid>
</Grid>
</local:WindowBase>