因此,我正在一個Windows Phone應用程序,我試圖移動兩個堆疊面板之間的元素(這基本上是我的應用程序的兩個主屏幕)。該參數是不正確的錯誤與堆疊面板
我有一個看起來像這樣一個支點項目:
<controls:Pivot Title="MY APPLICATION">
<!--Pivot item one-->
<controls:PivotItem Header="All Tokens">
<ListBox x:Name="AllTokenListBox" Margin="0,0,0,0">
<StackPanel x:Name="AllTokenStack"></StackPanel>
</ListBox>
</controls:PivotItem>
<!--Pivot item two-->
<controls:PivotItem Header="My Tokens">
<ListBox x:Name="MyTokenListBox" Margin="0,0,0,0">
<StackPanel x:Name="myTokenStack"></StackPanel>
</ListBox>
</controls:PivotItem>
</controls:Pivot>
當AllTokenStack一個項目是雙竊聽,我想將其移動到myTokenStack。當我這樣做時,程序崩潰並說「參數不正確」。 它只有這樣做,如果我不在調試模式(所以如果手機從電腦拔出,我嘗試運行應用程序)。如果它處於調試模式,它工作正常。
這裏是代碼我使用的轉學過來的對象:
private void container_Tap(object sender, GestureEventArgs e) {
if (AllTokenContainer.Children.Contains(this)) {
AllTokenContainer.Children.Remove(this);
MyTokenContainer.Children.Add(this);
}
}
有誰知道如何解決這個奇怪的錯誤?
編輯 只是爲了說清楚。 C#代碼位於我稱爲Token的類中。令牌類是一個用戶控件。這是用戶點擊觸發事件的控制。這是做錯了嗎?從異常
堆棧跟蹤:
at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
at MS.Internal.XcpImports.Collection_AddValue[T](PresentationFrameworkCollection`1 collection, CValue value)
at MS.Internal.XcpImports.Collection_AddDependencyObject[T](PresentationFrameworkCollection`1 collection, DependencyObject value)
at System.Windows.PresentationFrameworkCollection`1.AddDependencyObject(DependencyObject value)
at System.Windows.Controls.UIElementCollection.AddInternal(UIElement value)
at System.Windows.PresentationFrameworkCollection`1.Add(UIElement value)
at MTG_Token_Tracker.TokenGraphic.container_Tap(Object sender, GestureEventArgs e)
at MS.Internal.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)
在這種情況下'這'是什麼,你不想移動發件人? –
如果你有錯誤...發佈異常,而不是消息... –
要發佈異常詳細信息,請將您的container_Tap正文封裝在try/catch(異常e)中,並以某種方式顯示異常(e)(可能是MessageBox。顯示)... –