WPF Create Rectangle Tags on Image from DataBinding

Posted by Noah on Stack Overflow See other posts from Stack Overflow or by Noah
Published on 2010-06-13T15:38:57Z Indexed on 2010/06/13 15:42 UTC
Read the original article Hit count: 261

Filed under:
|
|
|

I'm trying to add image tags to a WPF image and I'm not having much luck. I'd like to do it through databinding if at all possible. Can I set a resource with a DataTemplate to take care of this?

Here's what I've been playing with to no avail:

    <Image Margin="25,4,14,46" 
           Name="MainImage" 
           Stretch="Uniform"
           MouseDown="MainImage_MouseDown" 
           Grid.Row="1" 
           HorizontalAlignment="Left"
           VerticalAlignment="Top"
           Source="{Binding Path=FileName}"
           >
        <Image.Resources>
            <DataTemplate DataType="{x:Type capp:CAPMeta}">
                <Label Content="{Binding Path=TagText}">
                </Label>
            </DataTemplate>
        </Image.Resources>                
    </Image>

Thanks!

© Stack Overflow or respective owner

Related posts about wpf

Related posts about .net-3.5