无法单击或选择控件XAML设计 [英] Cannot click or select Control XAML design

查看:50
本文介绍了无法单击或选择控件XAML设计的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows 7的VS2010 WPF上进行开发。我有一个项目不会引发任何错误或警告,可以正常编译,XAML设计可以正常显示,除非我无法在XAML设计视图中单击或选择任何控件。

是什么原因,或者如何找出问题或可能的异常?

解决方案

我通过将一个空网格放置为主 Grid 的最后一个子元素来重现此行为。在VS2010的设计器中,我无法选择任何 Button s。可能是您的问题吗?

 < Window x:Class = WpfApplication1.MainWindow 
xmlns = http ://schemas.microsoft.com/winfx/2006/xaml/presentation
xmlns:x = http://schemas.microsoft.com/winfx/2006/xaml
Title = MainWindow Height = 350 Width = 525>
< Grid>
< Button Content = Button Height = 52 Horizo​​ntalAlignment = Left Margin = 93,74,0,0 Name = button1 VerticalAlignment = Top Width = 113 /> ;
< Button Content = Button Height = 38 Horizo​​ntalAlignment = Left Margin = 280,100,0,0 Name = button2 VerticalAlignment = Top Width = 96 />

< Grid>< / Grid> < ;!-这就是问题!!! ->

< / Grid>
< / Window>


I develop on VS2010 WPF on Window 7. I have a project that does not throw any error or warning, compile fine, XAML design shows fine except I cannot click or select anyone controls in the XAML design view.

What is the reason, or how can I find out the problem or possible exception?

解决方案

I have reproduced this behavior by putting an empty grid as the last child element of my "main" Grid. In VS2010's designer, I cannot select any of the Buttons. Could this be your issue?

<Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <Button Content="Button" Height="52" HorizontalAlignment="Left" Margin="93,74,0,0" Name="button1" VerticalAlignment="Top" Width="113" />
        <Button Content="Button" Height="38" HorizontalAlignment="Left" Margin="280,100,0,0" Name="button2" VerticalAlignment="Top" Width="96" />

        <Grid></Grid>             <!--   THIS IS THE PROBLEM!!!  -->

    </Grid>     
</Window>

这篇关于无法单击或选择控件XAML设计的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆