views:

18

answers:

0

Hello. I develop surface app using MVVM pattern. I have different Views and I want to place them into one ScatterView. I want my ScatterViewItem size correspond to the size of my Views?

code example:

        <DataTemplate  DataType="{x:Type vm:PointListViewModel}">
         <Grid>                
          <v:PointListView>                  
          </v:PointListView>               
         </Grid>
        </DataTemplate>

        <DataTemplate DataType="{x:Type vm:BluetoothDevicesViewModel}">
         <Grid>
          <v:BluetoothDevicesView></v:BluetoothDevicesView>
         </Grid>
        </DataTemplate>

....

              <s:ScatterView Grid.RowSpan="3"
                   DataContext="{Binding Path=Workspaces}" 
                   ItemsSource="{Binding}" 
                   ItemTemplate="{Binding}" 
                   ClipToBounds="True" AllowDrop="True">
              </s:ScatterView>

... This code works fine but all my Views have the same size. I tried to configure ScatterViewItem with style like:

       <Style BasedOn="{StaticResource {x:Type s:ScatterViewItem}}"      
              TargetType="{x:Type s:ScatterViewItem}">

        <Setter Property="Height" Value="Auto" />
        <Setter Property="Width" Value="Auto" />
       </Style>

But it doesn't work.