我有一個觀點:在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等等