Hi,
I've added a NavBar to my application (in MainPage), and within the navbar content have added a listbox, but when I try to add elements to the listbox I get exception 'Object reference not set to an instance of an object.'. a section of the xaml, containing the listbox is:
<dxn:NavBarGroup IsExpanded="True" Header="Workspaces" DisplaySource="Content" ImageSource="/DemoApp;component/Images/layout_32x32.png" >
<dxn:NavBarGroup.Content>
<Grid>
<Grid.Resources>
<my:WorkSpaces x:Key="workspaces"/>
</Grid.Resources>
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Horizontal" Margin="5,15,0,0">
<Button Click="captureWorkspace_Click">
<Image Source="/DemoApp;component/Images/camera.png" />
</Button>
<Button>
<Image Source="/DemoApp;component/Images/Add_32x32.png" />
</Button>
<Button>
<Image Source="/DemoApp;component/Images/close-32x32.png" />
</Button>
<Button>
<Image Source="/DemoApp;component/Images/save-32x32.png" />
</Button>
<Button>
<Image Source="/DemoApp;component/Images/open-32x32.png" />
</Button>
</StackPanel>
<ListBox x:Name="workspaces" Margin="5" BorderBrush="Black" BorderThickness="1" />
</StackPanel>
</Grid>
</dxn:NavBarGroup.Content>
</dxn:NavBarGroup>
On pressing one of the buttons defined, captureWorkspace_Click is called, which adds to the listbox using:
workspaces.Items.Add("Default");
this is where the exception is raised.
I've tried placing the listbox onto Mainpage itself, rather than within the Navbar, and all works OK, so it seems to be
an issue when the listbox is contained within the Navbar.
Any help would be appreciated