I have been searching for this for ages now and still have no idea how to achieve it, this is my first C#/WPF application so it is entirely possible that I have seen the answer and just not known it, apologies if it is really easy.
I have a winForms application that launches a WPF window (the winForms is because the app is a system tray icon that spawns other windows). The only WPF window I have currently has two checkboxes that I have managed to store the value of in app.config, that value is also successfully applied to the checkboxes when the application first starts. However I cannot work out how to have the value applied to the checkbox every time the window is opened.
The window is opened by this (with an attempt to fix it commented out):
private void notifyIcon1_DoubleClick(object Sender, EventArgs e)
{
var RestartPortal = new RestartPortal();
//RestartPortal.InvalidateVisual();
RestartPortal.Show();
}
The values are applied to the window on application run with this (along with another attempt):
public RestartPortal()
{
InitializeComponent();
alwaysOnTopCheck.InvalidateVisual();
closeWhenCompleteCheck.InvalidateVisual();
alwaysOnTopCheck.IsChecked = bool.Parse(ConfigurationManager.AppSettings.Get("onTopChecked"));
closeWhenCompleteCheck.IsChecked = bool.Parse(ConfigurationManager.AppSettings.Get("autoCloseChecked"));
}
If can help out I will be incredibly appreciative.
Thank you.
Aucun commentaire:
Enregistrer un commentaire