我有三個按鈕,在我的WPF窗口什麼是點擊時禁用按鈕,使另外兩個按鈕啓用禁用按鈕點擊,並在其他按鈕啓用
<Button Name="initialzeButton"
Width="50"
Height="25"
Margin="460,0,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Click="initialzeButton_Click"
Content="Start"
Cursor="Hand" />
<Button Name="uninitialzeButton"
Width="50"
Height="25"
Margin="0,0,64,0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Click="uninitialzeButton_Click"
Content="Stop"
Cursor="Hand" />
<Button Name="loadButton"
Width="50"
Height="25"
Margin="0,0,9,0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Click="loadButton_Click"
Content="Load"
Cursor="Hand" />
現在我在每次使用這種方式的最佳途徑按鈕:(
private void uninitialzeButton_Click(object sender, RoutedEventArgs e)
{
this.uninitialzeButton.IsEnabled = false;
if (!this.initialzeButton.IsEnabled)
{
this.initialzeButton.IsEnabled = true;
}
if (!this.loadButton.IsEnabled)
{
this.loadButton.IsEnabled = true;
}
}
這是'button1_clcik'。您可以爲其他按鈕添加相同的處理程序 – akhil
我認爲這是web項目我的項目是wpf – tito11
然後添加適當的標記。 – akhil