Click here to Skip to main content
15,885,914 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
Hi,

I'm trying to create an app where the Expander buttons are stacked vertically in a StackPanel on the right side of my window.
When expanding the top item the new window appears to the left, as required, but the next expander button relocates itself below the bottom of the new window.
My target is to prevent the Expander buttons relocating, and to slide the new windows to the left, and should a second panel be expanded, the initial panel slides left to display all expanded panels.

<pre lang="xaml">
<StackPanel Name="StackPanel1" HorizontalAlignment="Right" Margin="0,24,0,0" Height="289">
    <StackPanel.Resources>
        <GridLines:ExpanderToBooleanConverter x:Key="ExpanderToBooleanConverter" />
    </StackPanel.Resources>
    <Expander Name="expander1" IsExpanded="{Binding SelectedExpander, Mode=TwoWay, Converter={StaticResource ExpanderToBooleanConverter}, ConverterParameter=1}" ExpandDirection="Left" Expanded="expander1_OnExpanded">
        <Expander.Header>
            <TextBlock Text="ADC">
                <TextBlock.LayoutTransform>
                    <RotateTransform Angle="90"/>
                </TextBlock.LayoutTransform>
            </TextBlock>
        </Expander.Header>
        <Grid>
            <DataGrid Height="250" HorizontalAlignment="Left" Name="listView1" VerticalAlignment="Top" Width="278" CanUserReorderColumns="False">
                <DataGrid.Columns>
                    <DataGridTextColumn Header="Name" Binding="{Binding X}" Width="200" />
                    <DataGridTextColumn Header="Value" Binding="{Binding Y}" Width="75" />
                </DataGrid.Columns>
            </DataGrid>
        </Grid>
    </Expander>
    <Expander Name="expander2" IsExpanded="{Binding SelectedExpander, Mode=TwoWay, Converter={StaticResource ExpanderToBooleanConverter}, ConverterParameter=2}" ExpandDirection="Left" Expanded="expander2_OnExpanded">
        <Expander.Header>
            <TextBlock Text="Logs">
                <TextBlock.LayoutTransform>
                    <RotateTransform Angle="90"/>
                </TextBlock.LayoutTransform>
            </TextBlock>
        </Expander.Header>
        <Grid>
            <DataGrid Height="250" HorizontalAlignment="Left" Name="listView2" VerticalAlignment="Top" Width="278" CanUserReorderColumns="False" Margin="0,-48,0,0">
                <DataGrid.Columns>
                    <DataGridTextColumn Header="Name2" Binding="{Binding X}" Width="200" />
                    <DataGridTextColumn Header="Value2" Binding="{Binding Y}" Width="75" />
                </DataGrid.Columns>
            </DataGrid>
        </Grid>
    </Expander>
</StackPanel>
</pre>

Additionally, I'm having a problem using the Office2007 style. I've used the ResourceDictionary approach

<pre><pre lang="xaml">
xmlns:ribbon="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"

<ResourceDictionary>
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/RibbonControlsLibrary;component/Themes/Office2007Blue.xaml"/>
    </ResourceDictionary.MergedDictionaries>
</ResourceDictionary>


I'm using WIN XP SP3, and VS2010 and I get the error
"An error occured findig the resource dictionary".
My project has RibbonControlsLibrary as a reference so i'm not sure what is going wrong.


Any help or pointers to samples would be much appreciated.

TIA

Tony
Posted
Updated 9-Jul-12 3:18am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900