This is not Silverlight code.....
Try this C# code,
First place List control(Display list of images),Textbox control, 3 buttons(One for Browse,One for Zoomin, one for ZoomOut)
Note change the name of the control resp.
Now try this code:
private void btnBrowse_Click(object sender, EventArgs e)
{
lstImagename.Items.Clear();
if(dlgFolder.ShowDialog() == DialogResult.OK)
{
var filePaths = Directory.GetFiles(strFldrpath, "*.*", SearchOption.AllDirectories)
.Where(s => s.EndsWith(".gif") || s.EndsWith(".jpg") || s.EndsWith(".bmp"));
int length = filePaths.Count();
int i = 0;
while (length > i)
{
lstImagename.Items.Add(new FileInfo(filePaths.ElementAt(i).ToString()).Name);
i++;
}
if (lstImagename.Items.Count == 0)
{
MessageBox.Show("Image(s) not available", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Information);
DialogResult resYesNo;
resYesNo = MessageBox.Show("Do you want to continue ", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
if (resYesNo == DialogResult.Yes)
{
btnBrowse_Click(sender, e);
}
else
{
txtFldrpath.Text = "";
}
}
txtFldrpath.Text = strFldrpath;
}
}
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
strImgName = txtFldrpath.Text + "\\" + lstImagename.SelectedItem;
pbxImg.Image = Image.FromFile(strImgName);
}
private void buttin_Click(object sender, EventArgs e)
{
if ((pbxImg.Width <= 322) & (pbxImg.Height <= 290))
{
pbxImg.Width = pbxImg.Width + 10;
pbxImg.Height = pbxImg.Height + 10;
}
}
private void buttout_Click(object sender, EventArgs e)
{
if ((pbxImg.Width >= 1) & (pbxImg.Height >= 1))
{
pbxImg.Width = pbxImg.Width - 10;
pbxImg.Height = pbxImg.Height - 10;
}
}
}