Add A label to a resizable an movable image

I have a project that does multi-touch...image moving, resizing etc. These images are loaded on the fly, so I don't know how many may load onto the canvas. The moving and resizing has all been worked out. However, I would like to put a label on each image.
When I place the Image usercontrol nto a container and make a label, I lose all ability to resize, which is crucial.
Here is the Picture controls XAML:
<UserControl x:Class="DocumentHandlingTouch.Picture"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Image Source="{Binding Path=ImagePath}" Stretch="Fill" Width="Auto" Height="Auto" RenderTransformOrigin="0.5, 0.5">
<Image.RenderTransform>
<TransformGroup>
<RotateTransform Angle="{Binding Path=Angle}"></RotateTransform>
<ScaleTransform ScaleX="{Binding Path=ScaleX}" ScaleY="{Binding Path=ScaleY}"></ScaleTransform>
<TranslateTransform X="{Binding Path=X}" Y="{Binding Path=Y}"/>
</TransformGroup>
</Image.RenderTransform>
</Image>
</UserControl>
Here is some of the Picture controls class...the portion i use to set the image path:
public partial class Picture : UserControl
public Picture()
InitializeComponent();
DataContext = this;
public string ImagePath
get { return (string)GetValue(ImagePathProperty); }
set { SetValue(ImagePathProperty, value); }
public string ImageName
get { return (string)GetValue(ImageNameProperty); }
set { SetValue(ImageNameProperty, value); }
public static readonly DependencyProperty ImageNameProperty =
DependencyProperty.Register("ImageName", typeof(string), typeof(Picture), new UIPropertyMetadata(""));
the complete code for what I'm doing can be found on OneDrive at DocumentHandling.
Again, I am not looking for any help in getting these images to move or resize, what I'm looking for is a way to get a label onto these images that still allows them to be moved or resized.

You could just add the following recursive FindParent method that will find the Picture parent element of the Image in the visual tree and make a small change to the FindPicture method in MainWindow.xaml.cs:
private Picture FindPicture(Point location)
HitTestResult result = VisualTreeHelper.HitTest(_canvas, location);
if (result == null)
return null;
Image image = result.VisualHit as Image;
if (image == null)
return null;
return FindParent<Picture>(image);
private static T FindParent<T>(DependencyObject dependencyObject) where T : DependencyObject {
var parent = VisualTreeHelper.GetParent(dependencyObject);
if (parent == null) return null;
var parentT = parent as T;
return parentT ?? FindParent<T>(parent);
..and use the following XAML markup for Picture.xaml user control:
<UserControl x:Class="DocumentHandlingTouch.Picture"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid>
<Grid.RenderTransform>
<TransformGroup>
<RotateTransform Angle="{Binding Path=Angle}"></RotateTransform>
<ScaleTransform ScaleX="{Binding Path=ScaleX}" ScaleY="{Binding Path=ScaleY}"></ScaleTransform>
<TranslateTransform X="{Binding Path=X}" Y="{Binding Path=Y}"/>
</TransformGroup>
</Grid.RenderTransform>
<Image Source="{Binding Path=ImagePath}" Stretch="Fill" Width="Auto" Height="Auto" RenderTransformOrigin="0.5, 0.5">
</Image>
<TextBlock Text="{Binding ImagePath}" VerticalAlignment="Bottom"/>
</Grid>
</UserControl>
Then it should work as expected.
Hope that helps.
Please remember to mark helpful posts as answer and please start a new thread if you have a new question.

Similar Messages

  • Where do I add a label tag in the code of a library item?

    Hello,
    For 508 compliance purposes I need to add a label tag to a list menu that I've created as a library item in Dreamweaver. Can anyone tell me where in the following code should the label code be added and how it should appear. The actual site is http://www.graphicmechanic.com/DEKALBCOUNTY/index.html. My 508 checker is telling me that I need to add a label to this form.
    The code is:
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link href="../cssfiles/lbistyles.css" rel="stylesheet" type="text/css"/>
    <form action="" method="post" name="form1" class="style52" id="form1">
                        <span class="style26"><strong>I WANT TO:</strong><br />
                        <img src="../images/5x5.gif" alt="layout graphic" width="5" height="5" /><br />
                        </span><span class="style26">
                        <select name="iwantto" class="style55" onchange="MM_jumpMenu('window.open()',this,0)">
                          <option value="http://web.co.dekalb.ga.us/voter/#">REGISTER TO VOTE</option>
                          <option value="https://govaffiliate.ezgov.com/ezutility/index.jsp?agency=3411">PAY MY WATER BILL</option>
                          <option value="../humanserv/hs-osa-facilities.html">FIND A SENIOR CENTER</option>
                          <option value="../humanserv/hs-lou-walker.html">GET INFO ABOUT LOU WALKER CENTER</option>
                          <option value="http://www.dekalbstatecourt.net/">FILE A RESTRAINING ORDER</option>
                          <option value="http://www.dekalbcountyanimalservices.com/">REPORT A LOOSE DOG</option>
                          <option value="http://web.co.dekalb.ga.us/courts/recorders/payment.asp">GET TRAFFIC CITATION INFO</option>
                          <option value="http://web.co.dekalb.ga.us/courts/probate/pistol.htm">APPLY FOR A PISTOL LICENSE</option>
                          <option value="http://web.co.dekalb.ga.us/courts/probate/marriage.htm">GET A MARRIAGE LICENSE</option>
                          <option value="http://www.co.dekalb.ga.us/dekalbflic/Centers.htm#service">FILE FOR A DIVORCE</option>
                          <option value="http://www.co.dekalb.ga.us/superior/index.htm">GET INFORMATION ABOUT JURY DUTY</option>
                          <option value="http://web.co.dekalb.ga.us/taxcommissioner/search.asp">PAY MY TAXES</option>
                        </select>
      </span> </label>
    </form>
    Any assistance would be appreciated.

    Okay i am having trouble figuring out exactly where I should insert the label code and how it should look in this code. I took a look at the labels link you sent over. It is helpful, but because this drop down list has no tables and the example does, I'm a bit confuse.
    Any chance you could show me an example of how a lable should look in in just one of the form items below? Then I could mimic it with the other items (with respect to each different title).
    Here is the code:
    <form action="" method="post" name="form1" class="style52" id="form1">
                        <span class="style26"><strong>I WANT TO:</strong><br />
                        <img src="../images/5x5.gif" alt="layout graphic" width="5" height="5" /><br />
                        </span><span class="style26">
                        <select name="iwantto" class="style55" onchange="MM_jumpMenu('window.open()',this,0)">
                          <option value="http://web.co.dekalb.ga.us/voter/#">REGISTER TO VOTE</option>
                          <option value="https://govaffiliate.ezgov.com/ezutility/index.jsp?agency=3411">PAY MY WATER BILL</option>
                          <option value="../humanserv/hs-osa-facilities.html">FIND A SENIOR CENTER</option>
                          <option value="../humanserv/hs-lou-walker.html">GET INFO ABOUT LOU WALKER CENTER</option>
                          <option value="http://www.dekalbstatecourt.net/">FILE A RESTRAINING ORDER</option>
                          <option value="http://www.dekalbcountyanimalservices.com/">REPORT A LOOSE DOG</option>
                          <option value="http://web.co.dekalb.ga.us/courts/recorders/payment.asp">GET TRAFFIC CITATION INFO</option>
                          <option value="http://web.co.dekalb.ga.us/courts/probate/pistol.htm">APPLY FOR A PISTOL LICENSE</option>
                          <option value="http://web.co.dekalb.ga.us/courts/probate/marriage.htm">GET A MARRIAGE LICENSE</option>
                          <option value="http://www.co.dekalb.ga.us/dekalbflic/Centers.htm#service">FILE FOR A DIVORCE</option>
                          <option value="http://www.co.dekalb.ga.us/superior/index.htm">GET INFORMATION ABOUT JURY DUTY</option>
                          <option value="http://web.co.dekalb.ga.us/taxcommissioner/search.asp">PAY MY TAXES</option>
                        </select>
      </span>
    </form>

  • How to display an image and add axis labels

    Hey everyone,
    I just had a really quick question on a program I created. It uses the vision module to open a file in a new display window, and I would like to add axis to the image simlilar to the picture below (With both the x and y axis labels as pixel, and a cursor which displays the pixel value or intensity). I have attached the simple program, as well as an example of the type of image I would like to open. Thank you for the help! =]
    Attachments:
    TEST1.zip ‏2223 KB

    I've updated the open_img.vi file so that it works with the generic sample picture provided, but the program does not work with the image within the ZIP file from the previous post.
    Or if anyone has any other ideas how to add axis labels to an image, I am by all means open to suggestion. Thanks
    Attachments:
    open_img.vi ‏47 KB
    Water lilies.jpg ‏82 KB

  • Trying to add Custom Label to iPad contacts

    I can find the Add Custom Label in the list of labels through contact - edit.  I can type in a new Custom Label  - but there is just no way to save it.  Tearing out what little hair I have.  Any advice appreciated.

    Sorry!  Just press Return on keyboard.  Idiot or what. Doh!

  • Add Custom Label

    Hello everyone,
    I am having SOOOOOOOOO many problems with my iPhone (funny thou, have no problems with my iPod touch) after updating to 3.1 this morning that are unbelievable. Can anyone tell me what happened to the option to ADD CUSTOM LABEL to a new contact? I can't add a custom label to a new contact but I can add or change custom label to any contacts that were there prior to the update.... Please HELP!!!!

    Creating contacts in your On My iPhone account will allow you to add custom labels; creating them in your Exchange account will not. I had the same problem until I realized that I had set the default account (under Mail, Contacts, Calendars in Seetings) to my Exchange account; I changed it to On My iPhone, and the issue went away. Of course, any contact created this way will no longer auto-sync with Exchange (unless you sync in some other way), but you will be able to use your custom labels.

  • IPhone iOS 7 "Add Custom Labels" order changed...No Longer Alphabetized!

    Help!  I updated my iPhone4 to ios 7 with the recent update.  I love everything about it, but when trying to find a custom label in "Contacts > John Doe > Edit > Mobile" and then scrolling down under the "Add Custom Label" menu, I found out that all of my custom labels which had previously been in alphabetized order were ordered according to what I can only guess was their date of creation.  With a massive list of clients and contacts from various walks of life and organizations, I created a reusable Custom Lable system since I came across that need in my line of work.  After ios 7, that suddenly got rearranged.  It never occurred in any other software or hardware update and I've been with iPhone since first gen.  How can take my Custom Labels and return to the alphabetized order with which they were previously arranged without losing ios 7?  Thanks for your help in advance.

    Hi Konsultix!
    Yeah, the customizable phone labels have been a real blessing up until recently.  If they ever figure this out, you should give it a try.  As for the lack of responsiveness which robodr mentioned, I'm not surprised.  We've pretty much been an all-Apple campus at my work with computers, portable devices, & even iPhones due to Apple's history with the philosophy of user-friendly simplicity.  Unfortunately, that philosophy seems to be changing towards lazy unforeseen complexity. The Mavericks switch (though free), the iWork updates, the rough iMovie launch, glitches with copier drivers resetting, the ios7 glitches, even this inexcusable lag in customer service here, all of it has my board and me rethinking our company-wide devotion to Apple including our iPhones.  If we're constantly troubleshooting, then Apple's nullified their advantage in the business sector and we might as well go for the cheaper Windows product since we're still constantly wasting our time & $$ on IT.  IT savings was the whole reason we convinced the board to switch in the first place.  Without it, Apple might as well kiss our money goodbye.  When Steve Jobs was alive, every detail was so well-thought out and customer service was at the top of its game.  Now, it's been a month since I posted a problem on Apple's website and no reply.  I'm glad to have this poor experience because, honestly, the timing couldn't be better.  My organization's AT&T phone contracts are expiring and we might begin switching more than our provider on this campus.

  • How to add extra labels into Bridge CS5?

    Hi folks, nice to meet you all.
    I do not want to edit or rename the existing 5 existing labels into Bridge CS5. I just want to create new labels. So, I want to add extra labels to have more than 5 labels.
    Does anybody know how to add extra labels into Bridge CS5? If so, please, tell me how to do it.
    Thanks.

    You should move this post to the new Bridge forum as this one will soon die.  Here is link http://forums.adobe.com/community/bridge/general

  • Missing 'Add Custom Label' button again

    A  mate and I both have an iphone 4, same firmware i.e. 6.1.3 and as far as i can see all settings are the same. However when entering the same  new contact on my phone I have at the bottom of the 'select phone type label' screen an add a 'Custom Label' button, the list of phone types labels on mine  are 'Mobile, iPhone, Home, Work, Main, Home Fax, Work Fax, Pager, Other' On my mates  his list is 'Home, work, home fax, work fax, pager, assistant, car, company main, radio' and the 'Add Custom Label' button is missing.
    Other contact entries on his phone have the same list as mine and they include the 'Add Custom Label' button.
      They are both only synchronised with icloud  Can anyone help please?

    I have found the answer - the 'Contacts' in my mates iPhone was set to 'Exchange' set it to 'iCloud' both iPhones now have the 'Add Custom Label' option

  • How to add custom label to a new contact in address book which is synced with outlook account

    Hello all,
    My iPhone is synced with outlook account. When I tried to create a new contact,'Add Custom Label' option was missing. Is Apple provides any solution to handle this? Is there any documentation provided about this behavior?

    The second script is working but if I need to change the link it will not allow me to edit or delete it in iCal on my desktop. The only way to edit it is to use the online iCal in me.com.
    And the worst problem is that the url does not show up on my iPhone iCal. The iPhone version of iCal has limited features. So if I'm away from the office on my iPhone I still have the problem of having no link to my iCal appointment. I still end up having to use both iCal and Contacts as separate Apps.
    I still dont understand why Apple wouldnt make these 2 Apps work together! It seems so obvious! thanks anyway.

  • Why am I able to add Custom Labels to some of my contacts and not to others?

    In some cases I have multiple telephone numbers I'd like to add to a Contact - sometimes several domestic and international mobile phone numbers for one contact. I'd like to be able to use "Add a Custom Label" to more accurately identify the phone (e.g., "Bob's India Phone"). Some of my contact entries allow me to do that, but other contacts do not include the "Add Custom Labels" option.
    Some of my contacts come from Exchange, while others were added on a POP or Mac email account.

    This is not completely true for me. I just added a new contact based on a call recieved and I am not able to add a custom label for this one. For others I can, no apparent reason why.
    I would like to add that I am running iOS 7.0.2 and the contact in question is also on iPhone (FaceTime available)
    I use this feature to add people in same company if small business and would be very happy to have this explained and solved.

  • I want to show movable image on form like data loding symbol

    Dear All, I am working on developer2000 6i version I want to show movable image on form like data loding symbol.currently i have taken .GIF Image but it is not moving so is there any way to do the same. oracle 10g forms 6i version Faizan

    Hi Faizan,
              Even i work on D2K (Forms 6i). I have tried this below & found the result.
         Its true that you can not add animated image. But you can definitely show a data loading symbol in code.
         Add 2 different contrast colours and choose a striped pattern.
    1) Create a text item with a lengthy rectangle (width minimum of 300).
    2) Create a visual attribute for it with desired colours.
    3) Finally add the following in between your code.
    Your Code
    set_item_property('YOUR_BLOCK.TEXT_ITEM',visible,property_true);
       set_item_property('YOUR_BLOCK.TEXT_ITEM', width,2);
    Your Code
    tot_wid:= get_item_property('YOUR_BLOCK.TEXT_ITEM', width);
    Your Code
    set_item_property('BLOCK3.PROGBAR', width,100);
    Your Code
    set_item_property('BLOCK3.PROGBAR', width,300);
    Message('Data Loading is completed');
    Try this out and let me know if its working as you expected & also let me know if there is a problem.

  • How to add a drop-down menu to a rollover image?

    Hi,
    I guess my title says it all... I was wondering how to add a drop-down menu to a rollover image? I know that there's the sprymenu, but I need to have my own rollover images.
    Thanks,
    Kazem

    Frankly, ANY link can offer a drop down.
    Take a look at this turorial.
    That will get you your dropdown menu. So you have that.
    Now, on your top menu (or any level where you want to have an image instead of text do this:
    (I am copying the HTML structure in the tutorial here):
    <nav>
              <ul>
                        <li><a href="#">Home</a></li>
                        <li><a href="#">Tutorials</a>
                                  <ul>
                                            <li><a href="#">Photoshop</a></li>
                                            <li><a href="#">Illustrator</a></li>
                                            <li><a href="#">Web Design</a></li>
                                  </ul>
                        </li>
                        <li><a href="#">Articles</a>
                                  <ul>
                                            <li><a href="#">Web Design</a></li>
                                            <li><a href="#">User Experience</a></li>
                                  </ul>
                        </li>
                        <li><a href="#">Inspiration</a></li>
              </ul>
    </nav>
    Now, let's pretend you want an image instead of the word "Articles." You'll want the image to be sized appropriately, and if you look at the CSS, you'll see it's 112 pixels wide by 52 high. If your image is approximately those dimensions, you're all set.
    So instead of "articles" you insert your image.
    Done.

  • Mac Mail resizing (compressible?) images

    I have been using Mac Mail to send images for a few years now. I am fully aware of the Image Size Option in the bottom right hand corner of Mail when an image has been attached. I use this feature often. Recently, the Large and Medium settings are too small. It reduces my 4.1MB image down to 108 KB for Large and Medium, and 70K for Small. In doing  research on these forums I came across a discussion about "compressible" images. What does that mean, and what would be making them (suddenly) un- or non-compressible such that this Mail setting would not work properly?
    In testing, I tried to send an un-edited image. In this case Mail works as it should, resizing the attached image reasonably, with four size options. My edited images seem to cause the problem. I edit in Photoshop (CS3) and always have. I can't remember another time when this has not worked as it should. I am wondering if this is a problem created by a recent update.
    Is anyone else experiencing this issue?
    Any insight, or fix, would be greatly appreciated.

    And only when it says Actual Size will the file be right. If it's set on small, medium or large files size will be reduced and will be turned into jpegs, no matter what the original version was.
    So open up an email and attach a file and look at what it says. If it says anything but Actual size the file is already altered. So change it to actual size and save as draft, which you can then delete.
    Then next time you attach an image it should say Actual Size because it defaults to whatever was last used. If it still changes then the file is probably too big, most emails have size limits and it's different for every service, so you have to check not only your own but the receiver of the email because if it's past their limit they will never get it.

  • Batch resize different sized images

    Hello,
    I'm hoping someone can point me in the right direction.  In the past I've used the image processor script to batch resize similarly sized images, but now I have a few hundred images that are all different sizes.  I would like to batch resize all these images so each image's longest side is resized to a specific size, while maintaining the current proportions.
    I am using CS5.
    Thanks in advance for any help,
    Adam

    Yeah, that's what I'm looking for.
    For example, if I have 3 images - 1200x1400px, 2700x2500px, and 3300x3300px.  I want to be able to batch resize all images so that their longest side is 200px while maintaining their current proportions.
    So afterwards, I would end up with 3 images - 171x200px, 200x185px, and 200x200px.

  • How to resize a gif image

    hi
    i need to resize a gif image to my preferable height and width . i have copied some code from net , its working fine for small images . but when i resize large images the background becomes back .... so
    any body help me put in this....
    regards
    mano

    hi
    thanks for ur reply . can u plz tell me were to insert the code here
    Image image = Toolkit.getDefaultToolkit().getImage("C:\\image.gif");
    MediaTracker mediaTracker = new MediaTracker(new Container());
    mediaTracker.addImage(image, 0);
    mediaTracker.waitForID(0);
    // determine thumbnail size from WIDTH and HEIGHT
    int thumbWidth = Integer.parseInt("120");
    int thumbHeight = Integer.parseInt("75");
    double thumbRatio = (double)thumbWidth / (double)thumbHeight;
    int imageWidth = image.getWidth(null);
    System.out.println("imageWidth "+ imageWidth);
    int imageHeight = image.getHeight(null);
    double imageRatio = (double)imageWidth / (double)imageHeight;
    if (thumbRatio < imageRatio) {
    thumbHeight = (int)(thumbWidth / imageRatio);
    } else {
    thumbWidth = (int)(thumbHeight * imageRatio);
    // draw original image to thumbnail image object and
    // scale it to the new size on-the-fly
    BufferedImage thumbImage = new BufferedImage(thumbWidth,
    thumbHeight, BufferedImage.TYPE_INT_RGB);
    Graphics2D graphics2D = thumbImage.createGraphics();
    graphics2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
    RenderingHints.VALUE_INTERPOLATION_BILINEAR);
    graphics2D.drawImage(image, 0, 0, thumbWidth, thumbHeight, null);
    // save thumbnail image to OUTFILE
    BufferedOutputStream out = new BufferedOutputStream(new
    FileOutputStream(args[1]));
    JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
    JPEGEncodeParam param = encoder.
    getDefaultJPEGEncodeParam(thumbImage);
    int quality = Integer.parseInt("75");
    quality = Math.max(0, Math.min(quality, 100));
    param.setQuality((float)quality / 100.0f, false);
    encoder.setJPEGEncodeParam(param);
    encoder.encode(thumbImage);
    out.close();
    System.out.println("Done.");

Maybe you are looking for