views:

10

answers:

0

I have two pages with scrollviewers on them. One works fine, the other doesn't work at all and I don't know why. I'm hoping someone can help me understand what the second doesn't work. The first is this:

<UserControl x:Class="DVCMaker.ViewPendingDVC"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:fxui="clr-namespace:SilverlightFX.UserInterface;assembly=SilverlightFX"
    mc:Ignorable="d"
    d:DesignHeight="700" d:DesignWidth="800">

    <Canvas>
        <ScrollViewer Name="svWindow" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
            <fxui:Interaction.Behaviors>
                <fxui:MouseWheelScroll />
            </fxui:Interaction.Behaviors>

            <StackPanel Canvas.Left="0" Canvas.Top="0" Height="700" Name="stackPanel1" Width="800">
            <Canvas Height="600" Name="cvPreview" Width="800">
                <Border Background="#FFFF80" BorderBrush="Black" BorderThickness="2">
                    <Image Canvas.Left="0" Canvas.Top="0" Height="600" Name="imgDVCFinal" Stretch="Fill" Width="800" />
                </Border>
            </Canvas>
            <Grid Height="100" Name="grid1" Width="800">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="250*" />
                    <ColumnDefinition Width="130*" />
                    <ColumnDefinition Width="40*" />
                    <ColumnDefinition Width="130*" />
                    <ColumnDefinition Width="250*" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="18*" />
                    <RowDefinition Height="62*" />
                    <RowDefinition Height="20*" />
                </Grid.RowDefinitions>
                <Button Content="Submit" Grid.Column="1" Grid.Row="1" Height="62" HorizontalAlignment="Left" Name="btnSubmit" VerticalAlignment="Top" Width="130" />
                <Button Content="Destroy" Grid.Column="3" Grid.Row="1" Height="62" HorizontalAlignment="Left" Name="btnDestroy" VerticalAlignment="Top" Width="130" />
            </Grid>
        </StackPanel>
        </ScrollViewer>
    </Canvas>
</UserControl>

In the second one, I originally had the outer canvas and then the controls that are listed, but without the Canvas:

<Canvas Canvas.Left="0" Canvas.Top="0" Height="768"  Width="1024">

I had to add that Canvas to keep from having multiple children to the Scrollviewer. I specify the size of that canvas to encapsulate all the controls, but the Scrollviewer doesn't show up... Here's the code that doesn't work:

<UserControl x:Class="DVCMaker.DVCComposer"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:fxui="clr-namespace:SilverlightFX.UserInterface;assembly=SilverlightFX"
    mc:Ignorable="d"
    d:DesignHeight="768" d:DesignWidth="1024">

    <Canvas>
        <ScrollViewer Name="svWindow" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
            <fxui:Interaction.Behaviors>
                <fxui:MouseWheelScroll />
            </fxui:Interaction.Behaviors>
            <Canvas Canvas.Left="0" Canvas.Top="0" Height="768"  Width="1024">
                <Border BorderBrush="Black">
                    <Canvas Canvas.Left="0" Canvas.Top="0" Height="600" Name="cvTemplate" Width="800" />
                </Border>
                <Button Canvas.Left="568" Canvas.Top="646" Content="Submit" Height="80" Name="btnSubmit" Width="94" />
                <StackPanel Canvas.Left="806" Canvas.Top="0" Height="600" Name="stackPanel1" Width="206">
                    <Button Content="Up" Height="24" Name="btnUp" Width="206" />
                    <StackPanel Orientation="Horizontal">
                        <Border Width="20" Background="black">
                            <StackPanel>
                                <Rectangle Width="10" Height="15" Margin="5,5,4,4" Fill="White"></Rectangle>
                                <Rectangle Width="10" Height="15" Margin="5,5,4,4"  Fill="White"></Rectangle>
                                <Rectangle Width="10" Height="15" Margin="5,5,4,4"  Fill="White"></Rectangle>
                                <Rectangle Width="10" Height="15" Margin="5,5,4,4"  Fill="White"></Rectangle>
                            </StackPanel>
                        </Border>
                        <Image Name="photo1" Height="100" Width="166"/>
                        <Border Width="20" Background="black">
                            <StackPanel>
                                <Rectangle Width="10" Height="15" Margin="5,5,4,4" Fill="White"></Rectangle>
                                <Rectangle Width="10" Height="15" Margin="5,5,4,4"  Fill="White"></Rectangle>
                                <Rectangle Width="10" Height="15" Margin="5,5,4,4"  Fill="White"></Rectangle>
                                <Rectangle Width="10" Height="15" Margin="5,5,4,4"  Fill="White"></Rectangle>
                            </StackPanel>
                        </Border>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <Border Width="20" Background="black">
                            <StackPanel>
                                <Rectangle Width="10" Height="15" Margin="5,5,4,4" Fill="White"></Rectangle>
                                <Rectangle Width="10" Height="15" Margin="5,5,4,4"  Fill="White"></Rectangle>
                                <Rectangle Width="10" Height="15" Margin="5,5,4,4"  Fill="White"></Rectangle>
                                <Rectangle Width="10" Height="15" Margin="5,5,4,4"  Fill="White"></Rectangle>
                            </StackPanel>
                        </Border>
                        <Image Name="photo2" Height="100" Width="166"/>
                        <Border Width="20" Background="black">
                            <StackPanel>
                                <Rectangle Width="10" Height="15" Margin="5,5,4,4" Fill="White"></Rectangle>
                                <Rectangle Width="10" Height="15" Margin="5,5,4,4"  Fill="White"></Rectangle>
                                <Rectangle Width="10" Height="15" Margin="5,5,4,4"  Fill="White"></Rectangle>
                                <Rectangle Width="10" Height="15" Margin="5,5,4,4"  Fill="White"></Rectangle>
                            </StackPanel>
                        </Border>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <Border Width="20" Background="black">
                            <StackPanel>
                                <Rectangle Width="10" Height="15" Margin="5,5,4,4" Fill="White"></Rectangle>
                                <Rectangle Width="10" Height="15" Margin="5,5,4,4"  Fill="White"></Rectangle>
                                <Rectangle Width="10" Height="15" Margin="5,5,4,4"  Fill="White"></Rectangle>
                                <Rectangle Width="10" Height="15" Margin="5,5,4,4"  Fill="White"></Rectangle>
                            </StackPanel>
                        </Border>
                        <Image Name="photo3" Height="100" Width="166"/>
                        <Border Width="20" Background="black">
                            <StackPanel>
                                <Rectangle Width="10" Height="15" Margin="5,5,4,4" Fill="White"></Rectangle>
                                <Rectangle Width="10" Height="15" Margin="5,5,4,4"  Fill="White"></Rectangle>
                                <Rectangle Width="10" Height="15" Margin="5,5,4,4"  Fill="White"></Rectangle>
                                <Rectangle Width="10" Height="15" Margin="5,5,4,4"  Fill="White"></Rectangle>
                            </StackPanel>
                        </Border>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <Border Width="20" Background="black">
                            <StackPanel>
                                <Rectangle Width="10" Height="15" Margin="5,5,4,4" Fill="White"></Rectangle>
                                <Rectangle Width="10" Height="15" Margin="5,5,4,4"  Fill="White"></Rectangle>
                                <Rectangle Width="10" Height="15" Margin="5,5,4,4"  Fill="White"></Rectangle>
                                <Rectangle Width="10" Height="15" Margin="5,5,4,4"  Fill="White"></Rectangle>
                            </StackPanel>
                        </Border>
                        <Image Name="photo4" Height="100" Width="166"/>
                        <Border Width="20" Background="black">
                            <StackPanel>
                                <Rectangle Width="10" Height="15" Margin="5,5,4,4" Fill="White"></Rectangle>
                                <Rectangle Width="10" Height="15" Margin="5,5,4,4"  Fill="White"></Rectangle>
                                <Rectangle Width="10" Height="15" Margin="5,5,4,4"  Fill="White"></Rectangle>
                                <Rectangle Width="10" Height="15" Margin="5,5,4,4"  Fill="White"></Rectangle>
                            </StackPanel>
                        </Border>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <Border Width="20" Background="black">
                            <StackPanel>
                                <Rectangle Width="10" Height="15" Margin="5,5,4,4" Fill="White"></Rectangle>
                                <Rectangle Width="10" Height="15" Margin="5,5,4,4"  Fill="White"></Rectangle>
                                <Rectangle Width="10" Height="15" Margin="5,5,4,4"  Fill="White"></Rectangle>
                                <Rectangle Width="10" Height="15" Margin="5,5,4,4"  Fill="White"></Rectangle>
                            </StackPanel>
                        </Border>
                        <Image Name="photo5" Height="100" Width="166"/>
                        <Border Width="20" Background="black">
                            <StackPanel>
                                <Rectangle Width="10" Height="15" Margin="5,5,4,4" Fill="White"></Rectangle>
                                <Rectangle Width="10" Height="15" Margin="5,5,4,4"  Fill="White"></Rectangle>
                                <Rectangle Width="10" Height="15" Margin="5,5,4,4"  Fill="White"></Rectangle>
                                <Rectangle Width="10" Height="15" Margin="5,5,4,4"  Fill="White"></Rectangle>
                            </StackPanel>
                        </Border>
                    </StackPanel>

                    <Button Content="Down" Height="24" Name="btnDown" Width="206" />
                </StackPanel>
                <ComboBox Canvas.Left="114" Canvas.Top="646" Height="24"  Width="226" Name="cbTemplate" SelectionChanged="TemplateSelectionChanged" >
                </ComboBox>
                <TextBlock Canvas.Left="138" Canvas.Top="620" Height="26" Name="textBlock1" Text="Template" FontSize="16" TextAlignment="Center" Width="164" />
            </Canvas>
        </ScrollViewer>
    </Canvas>

</UserControl>