反应我有一个简单的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
假设随着鼠标点击/点击发生某种视觉变化。至少,这是我的假设。 –