【发布时间】:2019-08-13 11:21:59
【问题描述】:
我有一个显示打开锁的窗口。 当用户单击按钮时,锁必须变为关闭状态,稍等片刻,然后关闭窗口。
如何使用 WPF 做到这一点?
这是我最初的 xaml:
<Button Grid.Row="2" BorderThickness="0" Background="Transparent" Margin="32"
IsTabStop="False" Click="BtnUnlockClick">
<Button.Content>
<Grid>
<Image Grid.Row="1" Source="/Common.Wpf;component/images/unlocked.png" Visibility="Visible" Name="imgUnlocked"/>
<Image Grid.Row="1" Source="/Common.Wpf;component/images/locked.png" Visibility="Collapsed" Name="imgLocked"/>
</Grid>
</Button.Content>
</Button>
和 C#:
private void BtnUnlockClick(object sender, RoutedEventArgs e)
{
//do stuff here
}
【问题讨论】: