开发者

WPF Create Rectangle Tags on Image from DataBinding

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>
            </Da开发者_运维知识库taTemplate>
        </Image.Resources>                
    </Image>

Thanks!


Well, I ended up using a canvas with ItemResources containing bound text to resolve this issue.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜