2012-02-13 7 views
2

私はWindows Phone(7.1)アプリケーションで "TreeViewのような"表示をしようとしています。
これを行うには、Silverlight Toolkitの「ExpanderView」を使用しています。Windows Phone ExpanderView - 「パラメータが正しくありません。」

基本的に、私のプログラムはExpanderViewsをExpanderViewsの中に追加してツリーを作成します。
要素が画面を水平方向に横切るまでは、「パラメータが正しくありません」という例外が表示されるまで、すべてが終了します。

// Code to execute on Unhandled Exceptions 
    private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) 
    { 
     if (System.Diagnostics.Debugger.IsAttached) 
     { 
      // An unhandled exception has occurred; break into the debugger 
      System.Diagnostics.Debugger.Break(); 
     } 
    } 

App.xaml.cs.の下に次のコードでは "Debugger.Break()" の行に

私は、この要素が完全にロードされていないアイテムを追加していた同じ要素でこの例外が発生していたため、要素が初期化されていないと仮定しています。

これは私のXAMLです:

<Grid x:Name="LayoutRoot" Background="Transparent"> 
    <Grid x:Name="ContentPanel" Margin="12,0,12,0"/> 
</Grid> 

<phone:PhoneApplicationPage.ApplicationBar> 
    <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True"> 
     <shell:ApplicationBarIconButton IconUri="/Images/Plus.png" Text="Add" Click="ApplicationBarIconButtonClick"/> 
    </shell:ApplicationBar> 
</phone:PhoneApplicationPage.ApplicationBar> 

そして、これは背後にあるコードです:

public MainPage() 
    { 
     InitializeComponent(); 

     _lastView = new ExpanderView { Header = "Header", IsExpanded = true }; 
     ContentPanel.Children.Add(_lastView); 
    } 

    private ExpanderView _lastView; 
    private void ApplicationBarIconButtonClick(object sender, System.EventArgs e) 
    { 
     var newItem = new ExpanderView {Header = "Header", IsExpanded = true}; 
     _lastView.Items.Add(newItem); 
     _lastView = newItem; 
    } 

(次の要素が水平方向に画面を超えた場合)私は、アプリケーションバーのボタンをクリックしてください非常に次回、それは私に例外を与える:

State Before Error

+0

どういう例外ですか?それはどのような線で起こるのですか? –

+2

私は私の質問の第2段落に述べました。 –

答えて

0

チェ最後にVisual Studioが更新されます。私はNuGetパッケージアップデートの前に同じ問題を抱えていました。 Vissual Studioの再起動が助けになりました

関連する問題