views:

166

answers:

3

Simple one: Want to add a LibraryContainer to a Surface ScatterView. Know I have to add the container inside a ScatterViewItem to get the rotate/move features.. but the SVI adds a rectangle box around the control, and it does not size correctly. Think I'm missing something simple but can't figure it... My current XAML is as follows:

Background="{StaticResource WindowBackground}" AllowDrop="True" > . . .

Any thoughts are appreciated... I've been looking at the how-to samples but the library controls that are shown are static item. (ie they are not movable)...

Rob

A: 

It's hard to say without seeing the rest of your source code, but generally you don't need to manually wrap your content in an SVI. Just add your control directly to the SV and an SVI will automatically be generated as a container. Move/Resize will work as long as internal controls aren't capturing the contacts first.

Ben Reierson
I've added a complete .XAML example in an "Answer" with a generic box showing the trouble... thx.
Rob Fleming
A: 

I understand what you are saying. It makes sense but does not behave as hoped. Below is an entire sample of the LibraryContainer. It's empty but shows the odd behaviors I'm getting. Namely: no resizing, a background rectangle I can't rid myself of..

Any suggestions are appreciated... rob

< s:SurfaceWindow x:Class="SurfaceApplication1.SurfaceWindow1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="http://schemas.microsoft.com/surface/2008" Title="SurfaceApplication1" > < s:SurfaceWindow.Resources> < ImageBrush x:Key="WindowBackground" Stretch="None" Opacity="0.6" ImageSource="pack://application:,,,/Resources/WindowBackground.jpg"/> < XmlDataProvider x:Key="MyData" XPath="CoverList" x:Name="xdpList"> < !-- Describe teh data grouping and bind to the data above --> < CollectionViewSource x:Key="MySourceOfData" Source="{Binding Source={StaticResource MyData}, XPath=Item}" > < CollectionViewSource.GroupDescriptions> < PropertyGroupDescription PropertyName="@Size" /> < /CollectionViewSource.GroupDescriptions> < /CollectionViewSource> < DataTemplate x:Key="MyDataTemp"> < Border BorderThickness="1" BorderBrush="White" Margin="3"> < Image Source="{Binding XPath=@Image}">

        < /Border>
    </DataTemplate>
</s:SurfaceWindow.Resources>


<Grid Background="{StaticResource WindowBackground}" >
    <s:ScatterView>
        <s:LibraryContainer Name="MainLibraryContainer" 
        Width="400" Height="200"
        ViewingMode="Bar" 
        ItemsSource="{Binding Source={StaticResource MySourceOfData}}" CanSwitchViewingMode="False" IsActive="True">

            <!-- Provide the view if a stack view select (not in use) -->
            <s:LibraryContainer.StackView>
                <s:StackView 
                NormalizedTransitionSize="1,1"
                ItemTemplate="{StaticResource MyDataTemp}">
                </s:StackView>
            </s:LibraryContainer.StackView>

            <!-- bar view of the data -->
            <s:LibraryContainer.BarView>
                <s:BarView 
                Rows="1"

                ItemTemplate="{StaticResource MyDataTemp}">
                </s:BarView>
            </s:LibraryContainer.BarView>

        </s:LibraryContainer>
    </s:ScatterView>
</Grid>

Rob Fleming
A: 

Hello dear. I quess you have to Write a ControlTemplate for the ScatterviewItem and pass the Library Stack in It. Or you Just set the Background of the ScatterviewItem to Transparent which might have the same effect. Because Transparent removes the HitTestvisibility on Non-covered Space.

Denny