1

简单的一个:想给一个Surface ScatterView添加一个LibraryContainer。知道我必须在 ScatterViewItem 中添加容器才能获得旋转/移动功能。但是 SVI 在控件周围添加了一个矩形框,并且它的大小不正确。认为我遗漏了一些简单但无法理解的东西......我当前的 XAML 如下:

背景="{StaticResource WindowBackground}" AllowDrop="True" > 。. .

任何想法表示赞赏...我一直在查看操作指南示例,但显示的库控件是静态项目。(即它们不可移动)...

更新:
我明白你在说什么。这是有道理的,但并不像希望的那样表现。下面是一个完整的示例LibraryContainer。它是空的,但显示了我得到的奇怪行为。即:没有调整大小,一个我无法摆脱的背景矩形..

任何建议表示赞赏。

< 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">
        </XmlDataProvider>
        < !-- 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}"></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>
</s:SurfaceWindow>
4

2 回答 2

1

我问你必须为 ScatterviewItem 编写一个 ControlTemplate 并在其中传递库堆栈。或者您只需将 ScatterviewItem 的背景设置为透明,这可能具有相同的效果。因为透明删除了非覆盖空间上的 HitTestvisibility。

于 2010-08-18T07:38:58.340 回答
0

没有看到其余的源代码很难说,但通常您不需要手动将内容包装在 SVI 中。只需将控件直接添加到 SV,SVI 就会自动生成为容器。只要内部控制不首先捕获联系人,移动/调整大小就可以工作。

于 2010-06-16T00:42:06.270 回答