Is there any way to view XAML tree loaded into a browser?
We are using one proprietary component, that loads xaml dynamically (Application.GetResourceStream), and there seems to be a problem with what it loads. How do I get a glimpse of xaml loaded?
Have you tried just wrapping the Stream returned by Application.GetResourceStream in a StreamReader to inspect the XAML?
Beyond that, Silverlight Spy is a great tool for inspecting the UI at runtime -- it lets you navigate the full visual tree and will even highlight what you've selected with a red rectangle inside the app.
Related
I have an application that uses a UserControl inside of a Window, Coded UI Testing recognizes everything in the Window (buttons, etc.) but inside the UserControl I just get a blue box around the area and cannot select anything inside for recording.
I've been all over google for this issue and I think it has to do with the AutomationPeers (?). Any suggestions would be useful in how to get these elements visible to Coded UI
If the custom control doesn't provide a customized/override version of the OnCreateAutomationPeer, you can't. You need to ask developers to implement automation support for their control.
UPDATE:
My issue was that Coded UI couldn't see past my TabControl (displays different user controls). I followed this solution to create a CustomTabControl and override the OnCreationAutomationPeer() method so that the lower elements could be displayed.
[ click here ]
I have some quite complex content behind several tabs. I'd like to force the layout to happen at application startup rather than lazily as the user clicks a tab for the first time. The delay is about a second or two per tab, and it's a bit embarrassing!
Edit: I think the problem is that only the selected tab's content control is in the visual tree. Calling ApplyTemplate of the HeaderedContentControl didn't make any difference.
Does this link help you?
wpf force to build visual tree
Basically it says to use ApplyTemplate on the ItemsControl...I guess that for the tabs you should do it for each TabItem.
There's also another technique used in this site:
http://xcalibur37.wordpress.com/2012/07/12/make-your-tabcontrol-preload-in-wpf-silverlight/
Here he creates a kind of preloader for each tab. It's for silverlight but I think it can be applied to WPF.
Hope it helps out :)
I have an Silverlight application that loads controls from external assemblies dynamically which works fine so far. The loaded control (a chart in this case) also gets the right datacontext (implicit by its parent) and displays its data correct.
But when I change some of the data in a binded datagrid I expect the chart to be updated as well. In fact it isn't. If I add another "local" chart it works but not on my chart from the external assembly. Is there something obvious I'm missing?
Thanks in advance.
Well, I really don't know why this doesn't work. So I changed my approach and began to load Xaml-files now instead of assemblies which works like charm.
I have a large WPF app and recently we have had icons disappear. We have the images as external resources that get loaded into memory. We have a custom button template where we set an ImageSource for the icons to show up. I used procmon to see that the image files are loaded into memory. I used WPF Snoop to see that the buttons have the images set correctly. Only some of the icons will disappear and then if you start the app again they might all be there. Using snoop if I change the imagesource to one of the files that loaded and are displayed, then that one will also show up, but if i put a "bad" one into a button that loaded fine before, the icon is still gone. When they disappear it is the same ones that disappear. And occasionally the wrong icon all together will appear on one of the buttons.
The button template has an Imagesource setup for the image to load and display.
This is really puzzling because one time everything loads just fine and the next, some of the icons are not loading. They are all png files.
Any ideas where to look next? Thanks.
One reason I can think of is that you just have one instance of each image, so if you use it one place it will disappear in other places. If you have the resources defined in XAML you can set x:Shared="false": http://msdn.microsoft.com/en-us/library/aa970778.aspx
Otherwise you'd have to create additional instances manually from your code.
Is it possible to drag an HTML 5 object, e.g. an <a draggable="true">, into a Silverlight 4 control and accept it? We've attempted to build a simple prototype using an HTML 5 example and a trivial Silverlight control but the cursor changes to the no-entry sign whenever we hover over the Silverlight control. We do, however, get drag entry events firing in Silverlight.
Our control happily accepts files dragged from the desktop as expected. We think we've got the HTML 5 drag events set up correctly, and I can possibly get our test published somewhere in case that will help. We've successfully implemented dragging inside a Silverlight control but we now need to integrate with non-Silverlight page components.
Is this actually possible to set up or are we just doing something wrong? Thanks for any advice!
Silverlight Drag drop from external sources currently supports only file lists.
You may however be able to get the <object> tag hosting the Silverlight plugin to respond to a dragging. If so you can use the Silveright HTML Bridge to handle these DOM events. Its a bit of a long shot though.
Short answer, as Anthony says is No.
You can emulate the functionality by using the
the drag entry event and mouse button up event, then create a silverlight control that most closely matches the HTML one you were dragging, and hide the original html control (which should snap back to its original position)...
Its a little messy, but it works...
Incidently, as far as i'm aware, dragging between 2 silverlight instances on the same page would require a similar technique...