Hello,
maybe I'm just doing something wrong:
In the constructor of the window (after InitializeComponent) I have this code:and when closing the window I'm serializing it this way (into Settings.settings file, property is of type XmlNavigationBarLayout:
The problem is that serializer.ApplyTo(this.navBar) fails, but the message is silly since it's a lie -- do I have to call something on this.navBar for the dynamically added items to be registered in some dictionary?
The output of the constructor Trace.WriteLine/.TraceError is the following:
maybe I'm just doing something wrong:
In the constructor of the window (after InitializeComponent) I have this code:
foreach ( var mod in modules )
{
var pane = mod.Attribute.GetNavPane(this);
pane.Title = mod.Attribute.GetTitle();
pane.Name = mod.Type.FullName.Replace('.', '_');
Trace.WriteLine(pane.Name, "add");
this.navBar.Items.Add(pane);
}
if ( Settings.Default.NavigationBarLayout != null )
{
var serializer = new NavigationBarLayoutSerializer(Settings.Default.NavigationBarLayout);
try
{
serializer.ApplyTo(this.navBar);
}
catch ( Exception ex )
{
Trace.TraceError(ex.ToString());
}
}
var serializer = new NavigationBarLayoutSerializer();
Settings.Default.NavigationBarLayout = serializer.CreateRootNodeFor(this.navBar);
The output of the constructor Trace.WriteLine/.TraceError is the following:
add: MyApp_SimpleWeekViewDocWin
add: MyApp_ProjektPlanerDocWin
MyApp.vshost.exe Error: 0 : System.Runtime.Serialization.SerializationException: No NavigationPane could be found with the Name 'MyApp_SimpleWeekViewDocWin'.
bei ActiproSoftware.Windows.Controls.Navigation.Serialization.NavigationBarLayoutSerializer.a(NavigationBar A_0, XmlNavigationPane A_1)
bei ActiproSoftware.Windows.Controls.Navigation.Serialization.NavigationBarLayoutSerializer.a(NavigationBar A_0, XmlNavigationBarLayout A_1)
bei ActiproSoftware.Windows.Controls.Navigation.Serialization.NavigationBarLayoutSerializer.ApplyTo(NavigationBar obj)