<ControlTemplate x:Key="CanvasTemplate"> <Grid> <ScrollViewer x:Name="ScrollViewer" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" > <Border removed="{Binding Path=Background,Converter={StaticResource ColorBrushConverter}}"> <ItemsPresenter x:Name="ItemsPresenter"/> </Border> </ScrollViewer> </Grid> </ControlTemplate> <ItemsControl x:Name="ic" DataContext="{Binding Path=CanvasViewModel}" ItemsSource="{Binding Path=Items}" Width="Auto" Height="Auto" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" ItemTemplateSelector="{StaticResource ItemDatatemplateSelector}" Template="{StaticResource CanvasTemplate}" > <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <Canvas IsItemsHost="True" DataContext="{Binding ElementName=ic, Path=DataContext}" Width="Auto" Height="Auto" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Background="Transparent" AllowDrop="True" > </Canvas> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemContainerStyle> <Style> <Setter Property="Canvas.Left" Value="{Binding Path=Left}"/> <Setter Property="Canvas.Top" Value="{Binding Path=Top}"/> </Style> </ItemsControl.ItemContainerStyle> </ItemsControl>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)