2010-06-15 20 views
1

简单的一种:想要将一个LibraryContainer添加到Surface ScatterView。知道我必须将容器添加到ScatterViewItem中才能获得旋转/移动功能..但SVI在控件周围添加了一个矩形框,并且它的大小不正确。想我失去了一些东西简单,但不能看着办吧......我现在的XAML如下:ScatterViewItem中的LibraryContainer:调整大小和背景矩形

背景= “{StaticResource的WindowBackground}” 的AllowDrop = “真”> 。 。 。

任何想法都赞赏......我一直在看how-to示例,但显示的库控件是静态项目。 (即他们不可移动)...

更新:
我明白你在说什么。这是有道理的,但并不像希望的那样行事。以下是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 [email protected]}"></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> 
+0

xaml的其余部分在哪里? – 2010-06-16 00:40:58

回答

0

很难说没有看到其他的源代码,但通常你不需要手动包装你的内容在SVI中。只需将您的控件直接添加到SV,并且SVI将自动生成为一个容器。只要内部控件不首先捕捉联系人,移动/调整大小将会起作用。

+0

我在一个“答案”中添加了一个完整的.XAML示例,其中包含一个显示麻烦... thx的泛型框。 – 2010-06-17 14:49:49

1

我想你必须为ScatterviewItem编写一个ControlTemplate并将它传递给Library Stack。或者你只需​​将ScatterviewItem的背景设置为透明,这可能具有相同的效果。因为透明会删除未覆盖空间上的HitTestvisibility。