There is a button on the window form. By pressing a button, a certain text file is opened in the Notepad program. After the text file is opened, the button on the window form has the property IsEnabled = false . Close the Notepad program, the button has the property IsEnabled = true .
Is it possible to make such a button in WPF-applications? And is it possible, before launching a WPF application, to do a button availability check on opening a certain text file in Notepad?
UPDATE:
I updated my post based on the answer to my question. There are two buttons in the application window: 1) Opens the desired text document, Visibility = Visibility.Visible 2) Closes the desired text document, Visibility = Visibility.Hidden . Actually, there is no difference what property to use in the control, I chose the Visibility property as an example.
I open a text file through a WPF application, the first button disappears, the second appears. I close the opened text file through the button, the second button disappears, the first appears. Question: Now in this new situation, is it possible to somehow track a specific instance of an open text file in Notepad? I just have just such buttons (or controls, there is no difference what will be), there will be several, moreover, I will programmatically add these buttons (or controls) to the ListBox.
I also forgot to mention the restriction of opening text files in Notepad through a WPF application: I can open a specific file no more than once. Of course, I understand that in this open instance of Notepad, I can open another text file, but I don’t consider this situation at all, so suppose the user doesn’t do that (although I don’t really know how track software).

