我有一个观点:在XAML中添加动态图像中的画布
<Grid>
<Canvas Grid.Row="1" Grid.Column="1" Grid.RowSpan="2" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" x:Name="ImageHolder">
<!-- there is something to do here !!! -->
<!-- like
<ImageCollection>
<DataTemplate For One Image>
<Image Canvas.Left="{Binding Path=posX}"
Canvas.Top="{Binding Path=posY}"
Source="{Binding Path=fileName}"
x:Name="{Binding Path=fileName}"
MouseDown="Img_MouseDown"
MouseUp="Img_MouseUp" />
</DataTemplate For One Image>
</ImageCollection> -->
</Canvas>
</Grid>
,是的.cs
public partial class WindowBoard : Window
{
protected MyCollectionVM _myCollection; // this class inherits of INotifyPropertyChanged
public WindowBoard()
{
InitializeComponent();
_myCollection = new MyCollectionVM();
}
}
我会为了使用数据绑定与动态图像添加在此XAML我ViewModelClass。
换句话说,我会知道如何创建一个userControl与一个dataTemplate图像,但许多图像动态添加。
我知道该怎么做,与列表视图,但我不知道怎么做,用帆布和没有GridView控件/ gridviewCellTemplate等等