反應我有一個簡單的WPF窗口,很簡單,一個TextBlock
和Button
。 但是,按鈕不響應任何事情。不是,如果我將鼠標移到它上面,或者如果我點擊它。從ButtonWPF按鈕沒有對任何事件
線:
<Button Margin="3" Command="Close" Content="Ok" Width="50"/>
全窗口代碼:
<Window x:Class="Launcher.XAML.MessageWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Name="self"
Title="{Binding ElementName=self, Path=Caption}" Height="194" Width="477">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Styles.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Text="{Binding ElementName=self, Path=Message}" Margin="10" TextWrapping="Wrap" />
<StackPanel Grid.Row="1" HorizontalAlignment="Right" Orientation="Horizontal">
<Button Margin="3" Command="Close" Content="Ok" Width="50"/>
</StackPanel>
</Grid>
你對此有何反應? – svick
假設隨着鼠標點擊/點擊發生某種視覺變化。至少,這是我的假設。 –