I Have 2 button , Start And capture. I want disable capture button on form load and enable start. and on after click on start disable start button and enable capture. Pleas
You should store current state in some variable (e.g. _capturing). When variable changing, you refresh IsEnabled property.
Xaml code:
C# code:
public partial class MainWindow : Window
{
private bool _capturing;
public MainWindow()
{
InitializeComponent();
// Some code
_capturing = false;
UpdateButtons();
}
private void StartButton_Click(object sender, RoutedEventArgs e)
{
// Some code
_capturing = true;
UpdateButtons();
}
private void CaptureButton_Click(object sender, RoutedEventArgs e)
{
// Some code
UpdateButtons();
}
private void UpdateButtons()
{
StartButton.IsEnabled = !_capturing;
CaptureButton.IsEnabled = _capturing;
}
}
UPDATE
You should add click handler and your xaml code will work: