Uploading Picture in UI is very Important It is Quite Easy. On upload button Event Write down The following code:
OpenFileDialog dlg;
FileStream fs;
byte[] data;
dlg = new Microsoft.Win32.OpenFileDialog();
dlg.ShowDialog();
if (dlg.FileName == "")
{
MessageBox.Show("Picture is not selected......");
}
else
{
fs = new FileStream(dlg.FileName, FileMode.Open, FileAccess.Read);
data = new byte[fs.Length];
fs.Read(data, 0, System.Convert.ToInt32(fs.Length));
fs.Close();
ImageSourceConverter imgs = new ImageSourceConverter();
SupplierLogoimage.SetValue(Image.SourceProperty, imgs.ConvertFromString(dlg.FileName.ToString()));
EnJoy....... !!
OpenFileDialog dlg;
FileStream fs;
byte[] data;
dlg = new Microsoft.Win32.OpenFileDialog();
dlg.ShowDialog();
if (dlg.FileName == "")
{
MessageBox.Show("Picture is not selected......");
}
else
{
fs = new FileStream(dlg.FileName, FileMode.Open, FileAccess.Read);
data = new byte[fs.Length];
fs.Read(data, 0, System.Convert.ToInt32(fs.Length));
fs.Close();
ImageSourceConverter imgs = new ImageSourceConverter();
SupplierLogoimage.SetValue(Image.SourceProperty, imgs.ConvertFromString(dlg.FileName.ToString()));
EnJoy....... !!
Comments
Post a Comment