tags:

views:

42

answers:

0

Hi there. I'm making an app where I have some expanders with listboxes that contains different objecttypes depending on which expander they are filed under. Each of those expanders with listboxes has a SelectionChanged which should show something in my "Mangriddy" grid. What they show in "Maingriddy" should depend on the selectionChanged event that is fired, hence they depend on the objecttype... The problem is: how do show something different in my "Maingriddy" ? I know i could just add the elements i want as children in my event, but I thought there might be an easier way ? Maybe it's possbile to "open" a xaml window in the grid or something ? Anyone?

<Window x:Class="O2.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="OIP" Height="300" Width="800" Loaded="Window_Loaded">
<Grid>
    <DockPanel Margin="0,0,0,0" Name="dockPanel1" LastChildFill="True" >
        <Menu Height="22" Name="menu1" Width="Auto" DockPanel.Dock="Top">
            <MenuItem Header="_File" Name="File" Click="File_Click"></MenuItem>
        </Menu>
        <StatusBar Height="18" Name="statusBar1" Width="Auto" DockPanel.Dock="Bottom" />
        <Grid Height="Auto" Name="MainGrid" Width="Auto" MinWidth="150" DockPanel.Dock="Left">
            <StackPanel>
                <Expander Header="Obj1" Name="Obj1Expander"  IsExpanded="True">
                    <ListBox Name="AdapterList" BorderThickness="0" SelectionChanged="ObjE1Event" >
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding Name}" />
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </Expander>
                <Expander Header="Profiles" Name="Profiles" IsExpanded="True" >
                    <ListBox Name="ProfilesList" BorderThickness="0"></ListBox>
                </Expander>
            </StackPanel>

        </Grid>
        <Grid Width="Auto" Name="MainGriddy" Visibility="Visible" >
            <GridSplitter HorizontalAlignment="Left" Margin="5,0,0,0" Name="gridSplitter1" Width="2" />
            <TextBox Margin="0,94,84,105" Text="testbox" Name="textBox1" HorizontalAlignment="Right" Width="120" />
        </Grid>
    </DockPanel> 
</Grid>