admin管理员组文章数量:1402982
In the code behind I cannot seem to access the Image (or any child) control of a Tooltip of an Image.
Setup: I have a UserControl with an image that on hover displays a tooltip with a larger version of the same source. The control is added to my View using:
<local:GetFrame x:Name="getframe" />
The image is then defined within the usercontrol as follows:
<StackPanel Orientation="Horizontal" x:Name="stkImage">
<TextBlock Text="Latest Image" Margin="0,0,5,0"/>
<Image Name="lastImageThumbnail" Source="/Content/blank.jpg" Height="30" Width="30" ToolTipService.ShowOnDisabled="True">
<Image.ToolTip>
<ToolTip Placement="Bottom">
<ToolTip.Template>
<ControlTemplate>
<StackPanel>
<Path Margin="5,0,0,0" Fill="DarkGray" Data="M 0 16 L 16 0 L 32 16 Z"/>
<Image Name="lastImage" Height="400" Width="400" Source="/Content/blank.jpg"/>
</StackPanel>
</ControlTemplate>
</ToolTip.Template>
</ToolTip>
</Image.ToolTip>
</Image>
At compile time both Image controls point to a resource of a 'default' image. At runtime after I trigger some action I want to update the Source for both images to a new image, but I cannot seem to access the child Image control. On this action lastImageThumbnail changes to my runtime BitmapImage.
if (File.Exists(fullpath))
{
var image = new BitmapImage(new Uri(fullpath));
getframe.lastImageThumbnail.Source = image;
getframe.lastImage.Source = image;
}
getframe.lastImage.Source has error S1061 'GetFrame' does not contain a definition for 'lastImage.... by giving the control a unique name I believed in WPF I should be able to access it but this does not appear to be the case.
本文标签: wpfImageSource of ImageTooltip unreachableStack Overflow
版权声明:本文标题:wpf - ImageSource of Image.Tooltip unreachable - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744088682a2589013.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论