I have a code snippet which is currently returned as Grid.
private Grid GetImage(PlacemarkList locationDetail)
{
Grid gridPushPin = new Grid();
ImageBrush img = new ImageBrush();
img.ImageSource = locationDetail.preferredCashback.Equals("1") ? new BitmapImage {
UriSource = Constants.CashbackIconUri,
DecodePixelWidth = 36,
DecodePixelHeight = 59
} : new BitmapImage {
UriSource = Constants.ATMIconUri,
DecodePixelWidth = 36, DecodePixelHeight = 59
};
TextBlock IndexText = new TextBlock();
IndexText.TextAlignment = TextAlignment.Center;
IndexText.Text = locationDetail.IndexNum.ToString();
gridPushPin.Background = img;
gridPushPin.Tag = locationDetail.bankAddress;
gridPushPin.Tap += grid_Tap;
return gridPushPin;
}
But I want to return the Grid as a Image(Convert the Grid I am generating to Image). Can anybody please help how to accomplish that.