LibraryStack itself belongs to ItemsControl and can display other components in a set. You can browse the components of the slice class one by one in LibraryStack, and it supports drag and drop operations by default. In the following example, we will use LibraryStack to display a group of images. First, write a ememplat for LibraryStack.
LibraryStack itself belongs to ItemsControl and can display other components in a set. You can browse the components of the slice class one by one in LibraryStack, and it supports drag and drop operations by default. In the following example, we will use LibraryStack to display a group of images. First, write a ememplat for LibraryStack.
LibraryStack itself belongs to ItemsControl and can display other components in a set. You can browse the components of the slice class one by one in LibraryStack, and it supports drag and drop operations by default.
In the following example, we will use LibraryStack to display a group of images. First, write a ememplate for LibraryStack to bind the image style. Next, add the LibraryStack control to the Grid and set the data template.
Finally, add a data source for LiraryStack. Note: The image string [] array cannot be directly assigned to the LiraryStack. You need to use ObservableCollection.
string imagesPath = @"C:\Users\Public\Pictures\Sample Pictures\";try{ string[] files = System.IO.Directory.GetFiles(imagesPath, "*.jpg"); ObservableCollection
items = new ObservableCollection
(files); mLibraryStack.ItemsSource = items;}catch (System.IO.DirectoryNotFoundException){ // Error info.}
Running interface:
Author: Li jingran (Gnie)
Source: {GnieTech} (http://www.cnblogs.com/gnielee)