Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

How to access a child control of an Application.Resource parent control?

$
0
0
<Application.Resources><tb:TaskbarIcon x:Key="mnuMainTaskbarIcon"
                    ToolTipText="hello world"
                    Visibility="Collapsed"><tb:TaskbarIcon.TrayPopup><Border x:Name="borderTest"  BorderBrush="#FF9AFFED" BorderThickness="1.5"
                    CornerRadius="3" Background="AliceBlue"
                        Width="100"
                        Height="300">

How would I access the border named "borderTest" in code?

I can access the parent object just find like this:

TaskbarIcon tb = new TaskbarIcon();
            tb = (TaskbarIcon)FindResource("mnuMainTaskbarIcon");

but this does not work with the border. I image because the border is not tagged with a key but a name instead. I can not seem to find a similar functionality that can be found in Template.FindName().



Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>