I have a FlipView in my MainPage . It has an ItemTemplate attached to a UserControl called landscapeControl . It ItemsSource tied to a list of class called MyLandscape .
landscapeControl:
<Grid> <ScrollViewer x:Name="LScrollViewer" MaxZoomFactor="2.0" MinZoomFactor="1.0" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" DoubleTapped="LScrollViewer_DoubleTapped" > <Canvas x:Name="inkCanvas" Background="Transparent"> <StackPanel x:Name="LStackPanel" Orientation="Horizontal" Margin="0,0,0,0"> <Image x:Name="LImage0" HorizontalAlignment="Right" Source="{Binding firstImage}" Width="570"/> <Image x:Name="LImage1" HorizontalAlignment="Left" Source="{Binding nextImage}" Width="570"/> </StackPanel> </Canvas> </ScrollViewer> </Grid>
MyLandscape class:
public class MyLandscape { public ImageSource firstImage { get; set; } public ImageSource nextImage { get; set; } public Canvas inkCanvas { get; set; } }
My images are displayed perfectly. All I want is 3 things:
1) I want to access my Canvas from my MainPage . I try to do this in the flipView_SelectionChanged event:
landscapeControl pc = flipView1.SelectedItem as landscapeControl; if (flipView1.Items.Count > 0) { var myCanvas = pc.getCanvas(); m_CanvasManager = new CanvasManager(myCanvas); }
But the variable p is always null! I want to snap my Canvas , so do I have a Canvas for every two images? Is it possible?
source share