“Silverlight”页面正常运行,但是"VS设计器"却解释错误,Why???

sswp7 2012-10-25 09:23:02
“Silverlight”页面正常运行,但是“VS设计器”却解释错误,这是怎么回事啊???



怎么排查这样的问题呢??? 找不出来原因啊,怎么解决???
...全文
410 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
sjfujiang 2012-11-19
  • 打赏
  • 举报
回复
引用 9 楼 sp1234 的回复:
很简单。 找到上面提示中最后(最上面)的一个你自己写的代码页,通常是一个用户控件(不一定就是当前的用户控件),然后打开此用户控件的Loaded事件处理方法,在第一行加入C# code?12if (DesignerProperties.IsInDesignTool) return;
楼主有没有试这个?效果如何.
starrycheng 2012-11-19
  • 打赏
  • 举报
回复
大师,您怎么看呢?
starrycheng 2012-10-31
  • 打赏
  • 举报
回复
详细错误信息:
System.Reflection.TargetInvocationException
调用的目标发生了异常。

在 System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
在 System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
在 System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
在 System.Delegate.DynamicInvokeImpl(Object[] args)
在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
在 MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)


System.InvalidOperationException
元素“Microsoft.Windows.Design.Platform.SilverlightViewProducer+SilverlightContentHost”的布局测量覆盖不应将 PositiveInfinity 作为其 DesiredSize 返回,即使将 Infinity 作为可用大小传入。

在 System.Windows.UIElement.Measure(Size availableSize)
在 MS.Internal.Designer.ZoomableViewPresenter.DesignerBackground.MeasureOverride(Size constraint)
在 System.Windows.FrameworkElement.MeasureCore(Size availableSize)
在 System.Windows.UIElement.Measure(Size availableSize)
在 Microsoft.Windows.Design.Interaction.DesignerView.MeasureOverride(Size constraint)
在 System.Windows.FrameworkElement.MeasureCore(Size availableSize)
在 System.Windows.UIElement.Measure(Size availableSize)
在 MS.Internal.Designer.Viewport.MeasureOverride(Size availableSize)
在 System.Windows.FrameworkElement.MeasureCore(Size availableSize)
在 System.Windows.UIElement.Measure(Size availableSize)
在 MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
在 System.Windows.Controls.ScrollContentPresenter.MeasureOverride(Size constraint)
在 System.Windows.FrameworkElement.MeasureCore(Size availableSize)
在 System.Windows.UIElement.Measure(Size availableSize)
在 System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
在 System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
在 System.Windows.Controls.Grid.MeasureOverride(Size constraint)
在 System.Windows.FrameworkElement.MeasureCore(Size availableSize)
在 System.Windows.UIElement.Measure(Size availableSize)
在 System.Windows.Controls.ScrollViewer.MeasureOverride(Size constraint)
在 System.Windows.FrameworkElement.MeasureCore(Size availableSize)
在 System.Windows.UIElement.Measure(Size availableSize)
在 System.Windows.Controls.Grid.MeasureOverride(Size constraint)
在 System.Windows.FrameworkElement.MeasureCore(Size availableSize)
在 System.Windows.UIElement.Measure(Size availableSize)
在 MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
在 System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
在 System.Windows.FrameworkElement.MeasureCore(Size availableSize)
在 System.Windows.UIElement.Measure(Size availableSize)
在 System.Windows.Controls.Control.MeasureOverride(Size constraint)
在 System.Windows.FrameworkElement.MeasureCore(Size availableSize)
在 System.Windows.UIElement.Measure(Size availableSize)
在 System.Windows.Interop.HwndSource.SetLayoutSize()
在 System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)
在 MS.Internal.DeferredHwndSource.ProcessQueue(Object sender, EventArgs e)
starrycheng 2012-10-31
  • 打赏
  • 举报
回复
“BusyIndicator”引发了一个错误,很奇怪啊。



完整XAML代码:


<controls:ChildWindow x:Class="MyCharts.MeterListChartWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
xmlns:vc="clr-namespace:Visifire.Charts;assembly=SLVisifire.Charts"
xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
Width="900" Height="300"
>

<Grid x:Name="LayoutRoot" Margin="2">
<toolkit:BusyIndicator Name="bi_Busy" BusyContent="数据加载中,请稍后。。。">
<Grid></Grid>
</toolkit:BusyIndicator>

</Grid>

</controls:ChildWindow>错误
1 [Control_TargetTypeMismatch]

参数:
调试资源字符串不可用。键和参数通常会提供足够的信息来诊断问题。请参见 http://go.microsoft.com/fwlink/?linkid=106663&Version=5.1.10411.0&File=System.Windows.dll&Key=Control_TargetTypeMismatch
C:\Users\Administrator\Desktop\Tj2.0\MyCharts\MeterListChartWindow.xaml
11 9
MyCharts

问题:大师,只是放了一个“BusyIndicator”,怎么会这个样呢??? 这是什么错误,应该如何解决。




后台代码:

namespace MyCharts
{
public partial class MeterListChartWindow : ChildWindow
{


public MeterListChartWindow(string title,string tag)
{
InitializeComponent();
}

}
}
sswp7 2012-10-29
  • 打赏
  • 举报
回复
[Quote=引用 9 楼 的回复:]

很简单。

找到上面提示中最后(最上面)的一个你自己写的代码页,通常是一个用户控件(不一定就是当前的用户控件),然后打开此用户控件的Loaded事件处理方法,在第一行加入C# code
if (DesignerProperties.IsInDesignTool)
return;
[/Quote]

大师,VS没有报错啊,找不到错误原因,这是麻烦啊。。。
starrycheng 2012-10-29
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 的回复:]

1、有可能XML里有一些语法错误,但错误不是严重错误。

2、你把项目关了,重新打开一下看看会不会好。

3、如果是新建窗白页。VS设计器就报这个错误是因为Silverlight客户端(Silverlight Developer)和SilverlightTools(SDK)版本不一样。
比如说你在你的机器安的Silverlight5.0然后你又安了一个SilverlightTools4……
[/Quote]

应该不是“版本”问题,因为有些页面可以直接打开的。
starrycheng 2012-10-29
  • 打赏
  • 举报
回复
[Quote=引用 9 楼 的回复:]

很简单。

找到上面提示中最后(最上面)的一个你自己写的代码页,通常是一个用户控件(不一定就是当前的用户控件),然后打开此用户控件的Loaded事件处理方法,在第一行加入C# code
if (DesignerProperties.IsInDesignTool)
return;
[/Quote]

大师,为什么要这样做??? 原来不这样也是好的啊。。。
  • 打赏
  • 举报
回复
很简单。

找到上面提示中最后(最上面)的一个你自己写的代码页,通常是一个用户控件(不一定就是当前的用户控件),然后打开此用户控件的Loaded事件处理方法,在第一行加入
if (DesignerProperties.IsInDesignTool)
return;
TNight 2012-10-27
  • 打赏
  • 举报
回复
sp1补丁没有打,碰到过这个问题
wangyue4 2012-10-27
  • 打赏
  • 举报
回复
我印象里有时关了再开就解决了
ZWYyj 2012-10-26
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 的回复:]
1、有可能XML里有一些语法错误,但错误不是严重错误。

2、你把项目关了,重新打开一下看看会不会好。

3、如果是新建窗白页。VS设计器就报这个错误是因为Silverlight客户端(Silverlight Developer)和SilverlightTools(SDK)版本不一样。
比如说你在你的机器安的Silverlight5.0然后你又安了一个SilverlightTools4.……
[/Quote]

说的好呀。。我也常常出现这样的状况,有时候不管他,直接调试也行。。。。
夺命胖子 2012-10-25
  • 打赏
  • 举报
回复
我经常性看不到,出错,,就那样开发,,习惯了,
starrycheng 2012-10-25
  • 打赏
  • 举报
回复
starrycheng 2012-10-25
  • 打赏
  • 举报
回复
ExpressionBlend中看不到“设计视图”:





starrycheng 2012-10-25
  • 打赏
  • 举报
回复
希望可以找出原因来。。。
wwwljh 2012-10-25
  • 打赏
  • 举报
回复
1、有可能XML里有一些语法错误,但错误不是严重错误。

2、你把项目关了,重新打开一下看看会不会好。

3、如果是新建窗白页。VS设计器就报这个错误是因为Silverlight客户端(Silverlight Developer)和SilverlightTools(SDK)版本不一样。
比如说你在你的机器安的Silverlight5.0然后你又安了一个SilverlightTools4.0的SDK。就会报这种错误。解决方法安装一致的Silverlight Developer和SilverlightTools。把SilverlightTools的安装包用Winrar解压后里面就有ilverlight Developer,安装一下就可以。

8,735

社区成员

发帖
与我相关
我的任务
社区描述
WPF/Silverlight相关讨论
社区管理员
  • WPF/Silverlight社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧