Reading from and writing to the host filesystem
The new I/O dialog boxes in Silverlight allow our application to store and read files from outside of the isolated storage area, which we have discussed earlier.
To open a file in Silverlight, we use the OpenFileDialog
class, which enables us to ask the user for one or more files from his system and load the data from these files to the memory. The OpenFileDialog
class exposes the following three properties for customizing the selections presented to the user when the dialog box is launched:
Filter:
This enables us to filter which type or types of files the user can select from this dialog box.FilterIndex:
If you allow the user to select from multiple file formats, setting this property will determine which filter is the default one.MultiSelect:
This is a Boolean property, which specifies whether the user can select a single file or multiple files. If not set, the default behavior of the dialog box is to allow the user to select a single...