2009-01-30 3 views
2

J'ai VS2008 avec .net 3.5 SP1 installé sur ma machine, j'ai écrit une application simple avec deux listes de vues et de liaison de données, mon application compile bien et je suis capable de courir il, mais quand j'essaie d'ouvrir le concepteur pour modifier les contrôles, je reçois erreur suivante. Je ne comprends pas pourquoi cela arrive. Toute idée ... voir ci-dessous XAML ce message d'erreurWPF Designer exception en essayant d'éditer l'interface utilisateur dans Visual studio 2008

type 'MS.Internal.Permissions.UserInitiatedNavigationPermission' à l'Assemblée 'PresentationFramework, Version = 3.0.0.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35' est pas marqué comme sérialisable. à System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers (type RuntimeType) à System.Runtime.Serialization.FormatterServices.GetSerializableMembers (type de type, le contexte StreamingContext) à System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo() à System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize (Object obj, ISurrogateSelector surrogateSelector, le contexte StreamingContext, SerObjectInfoInit serObjectInfoInit, convertisseur IFormatterConverter, objectWriter objectWriter) à System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize (Objet obj, ISurrogateSelector surrogateSelector, Contexte StreamingContext, SerObjectInfoInit serObjectInfoInit, Convertisseur IFormatterConverter, ObjectWriter objectWriter) at System.Ru ntime.Serialization.Formatters.Binary.ObjectWriter.Write (WriteObjectInfo objectInfo, NomInfo memberNameInfo, NomInfo typeNameInfo) at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize (Graphique d'objet, Header [] inHeaders, __BinaryWriter serWriter, Boolean fCheck) at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize (Flux serializationStream, Objet graphique, En-tête [] en-têtes, fCheck booléen) à System.Runtime.Remoting.Channels.CrossAppDomainSerializer.SerializeObject (Object obj, MemoryStream stm) à System.AppDomain.Serialize (Object o de) à System.AppDomain.MarshalObject (Object o de) à System.Threading.CompressedStack.GetDomainCompressedStack (SafeCompressedStackHandle compressedStack, index Int32) à System.Security.Permissi onListSet.CreateCompressedState (CompressedStack cs, CompressedStack innerCS) à System.Threading.CompressedStack.CompleteConstruction (CompressedStack innerCS) à System.Threading.CompressedStack.GetCompressedStack (StackCrawlMark & stackMark) à System.Security.SecurityContext.Capture (ExecutionContext currThreadEC, StackCrawlMark & stackMark) à System.Threading.ExecutionContext.Capture (StackCrawlMark & stackMark) à System.Threading.ExecutionContext.Capture() à System.Windows.Threading.Dispatcher.BeginInvokeImpl (priorité de DispatcherPriority, méthode délégué, objet args, Boolean isSingleParameter) à System.Windows.Threading.Dispatcher.BeginInvoke (DispatcherPriority p RIORITÉ, procédé délégué, arg Object) à System.Windows.Input.CommandManager.RaiseRequerySuggested() à System.Windows.Input.CommandManager.InvalidateRequerySuggested() à Microsoft.Windows.Design.Interaction.Tool.TaskCollection.InsertItem (Index Int32, élément de tâche) à System.Collections.ObjectModel.Collection`1.Add (élément T) à Microsoft.Windows.Design.Interaction.SelectionTool..ctor() à MS.Internal.Providers.VSActiveToolProvider.SelectionToolFactory .TryCreateTool [T] (outil T &) à MS.Internal.Host.ToolSubsystem.ActivateTool (ToolFactory toolFactory) à MS.Internal.Host.ToolSubsystem..ctor (EditingContext editingContext, DesignerContext designerContext) à MS.Internal. Ho st.Designer.Load() à MS.Internal.Designer.VSDesigner.Load() à MS.Internal.Designer.VSIsolatedDesigner.VSIsolatedView.Load() à MS.Internal.Designer.VSIsolatedDesigner.VSIsolatedDesignerFactory.Load (vue IsolatedView) à MS.Internal.Host.Isolation.IsolatedDesigner.BootstrapProxy.LoadDesigner (Usine IsolatedDesignerFactory, vue IsolatedView) à MS.Internal.Host.Isolation.IsolatedDesigner.BootstrapProxy.LoadDesigner (usine IsolatedDesignerFactory, vue IsolatedView) à MS.Internal.Host.Isolation.IsolatedDesigner.Load() à MS.Internal. Designer.DesignerPane.LoadDesignerView()

XAML:

<Grid Name="pngrid_Base" Height="auto" Width="auto" Background="Beige"> 
    <Grid.ColumnDefinitions> 
     <ColumnDefinition Width="auto" MinWidth="221"></ColumnDefinition> 
     <ColumnDefinition Width="auto" MinWidth="1" MaxWidth="1"></ColumnDefinition> 
     <ColumnDefinition Width="auto"></ColumnDefinition> 
    </Grid.ColumnDefinitions> 
     <Grid Name="pngrid_BaseForAll" Grid.Column="0" Width="auto" HorizontalAlignment="Left" Background="#FFD8E4F8"> 
    <Grid.RowDefinitions> 
     <RowDefinition Height="30*"/> 
     <RowDefinition Height="164*" /> 
     <RowDefinition Height="35*" /> 
     <RowDefinition Height="164*" /> 
     <RowDefinition Height="40*" /> 
    </Grid.RowDefinitions> 
     <ListView Name="lstview_Unack" Grid.Row="1" Margin="2,0,0,0" SelectionMode="Extended" LostFocus="lstview_Unack_LostFocus" 
                           MouseRightButtonDown="lstview_Unack_MouseRightButtonDown"> 

      <ListView.ItemContainerStyle> 
       <Style TargetType="ListViewItem"> 
        <Setter Property="IsSelected" Value="{Binding Path=IsSelected, Mode=TwoWay}" /> 
       </Style> 
      </ListView.ItemContainerStyle> 
     </ListView> 
     <Button Grid.Row="2" HorizontalAlignment="Left" Margin="24,14,0,5" Name="btnFreeze">Freeze</Button> 
      <Button Grid.Row="2" HorizontalAlignment="Left" Margin="12,7,0,5" Name="btnAcknowledge" Width="96">Acknowledge</Button> 
     <ListView Name = "lstview_Ack" Grid.Row="3" Margin="2,1,0,0" LostFocus="lstview_Ack_LostFocus" SelectionMode="Extended" MouseRightButtonDown="lstview_Ack_MouseRightButtonDown"> 
      <ListView.ItemContainerStyle> 
       <Style TargetType="ListViewItem"> 
        <Setter Property="IsSelected" Value="{Binding Path=IsSelected, Mode=TwoWay}" />        
       </Style> 
      </ListView.ItemContainerStyle> 
     </ListView> 


     <Button Grid.Row="4" HorizontalAlignment="Left" Margin="16,12,0,7" Name="Clear" Width="78">Clear</Button> 
    <TextBox Margin="110,6,32,5" Name="FilterText" TextChanged="FilterText_TextChanged" /> 
    <ComboBox HorizontalAlignment="Left" Margin="14,5,0,4" Name="comboColumnList" Width="94" /> 
</Grid> 
    <GridSplitter Grid.Column="1" Name="gridSplitter1" Width="2" HorizontalContentAlignment="Center" VerticalContentAlignment="Stretch" HorizontalAlignment="Left" Background="Azure" /> 
    <Grid Name="pnGridForTreeView" Grid.Column="2" Width="200" Grid.ColumnSpan="2"> 
     <my:TrinityDeviceTree x:Name ="m_objDeviceTree" Height="auto" Width="auto"> 

     </my:TrinityDeviceTree> 
    </Grid> 

</Grid> 

+0

Est-ce que ça marche en mélange? –

+0

Je n'ai pas essayé dans le mélange –

+0

ce qui pourrait être la raison d'une telle erreur ... il semble que cette erreur est très commune, mais la solution n'est pas ... ont vu beaucoup de messages avec cette erreur –

Répondre

1

Je l'ai testé votre code à l'intérieur VS2008 avec .NET 3.5 SP1 et si je retire la déclaration pour TrinityDeviceTree il fonctionne très bien avec le concepteur. Peut-être que vous devriez reprendre ce UserControl et y chercher des erreurs. Essayez également de faire un nettoyage de votre projet et une reconstruction, parfois cela fonctionne pour les problèmes de concepteur visuel.