WPF: How to know Open Window, User control name - wpf

In the web application, we just right click on the page go to properties and can see the opened page path. How to achieve this in WPF application. I am running a WPF app having windows with many user control. I want to edit a user control. So I want to know its name and location in my project folder.

That is not possible like how you can in a web application, however there are some tools that can help you.
WPF Snoop
Used to inspect WPF application rather like 'Inspect Element' in a webpage. After inspection, pressing ALT+SHIFT will higlight what element is under the mouse and show you its name. Then you can search for that name in Visual Studio to find the class to edit.
See https://github.com/snoopwpf/snoopwpf
Visual Studio XAML Inspector
The microsoft version of the above 'Live Visual Tree Inspector' now built into Visual Studio and compatible with .NET Core 3.0 as well as .NET Framework.
See https://learn.microsoft.com/en-gb/visualstudio/xaml-tools/inspect-xaml-properties-while-debugging?view=vs-2019

Related

VS How To Enable XAML Visual Editor for Xaml files (outside of WPF project)?

Visual Studio Community 2015. Xamarin Test Project.
I have a project which have some layouts - Layout.xaml
It shows the designer - it looks like an XML editor of some sort - but what I am looking for is the Visual Xaml Designer - where you see the results of what you do.
If you open any WPF project you will and doulbe click any of its default Xaml files - you will see a nice looking Xaml Visual and Code Editor combined. How can I enable the same within my Xamarin project?
Why Xaml that is in WPF project shows that nice Visual Editor and Xamarin Project does not? Is there a way to bind it?
It has to depend on the project type I assume.
PS: I have a droid project and the iOS and a portable library where I have those XAML files.
If you have any more questions - please ask.
Update
I tried installing Microsoft.Xaml (through Nuget Package manager) - still no luck
Update 2
I create a basic WPF project and look at its references. I matched it identically with my project - but still no luck
Update 3
WPF Project has different properties (which makes sense)
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
And my XAML files have these
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
Even though I knew manipulating those would not launch Xaml Visual Designer - still tried that with no luck.
What loads this XAML Visual Designer for the WPF project????
This is the answer - there is a Xamarin.Forms Previewer
Use the View > Other Windows > Xamarin.Forms Previewer menu in Visual Studio to open the preview window. Use the Window > New Vertical Tab Group menu to position it side-by-side.
There is no direct possibility for a preview of your XAML-views, but you can use Gorilla Player(http://gorillaplayer.com/) a software which allows a such function

Behaviours in wpf apps Microsoft expression blend 4

I am using Microsoft expression blend 4 and i want to add a simple button,in a wpf application, which by clicking it(on "Run Project" mode) navigates the user to another existing wpf application in expression blend 4.This can be done by using a method but maybe I used the wrong method or i used the right method the wrong way.To be more specific i dragged on the button(that i want to make the task i mentioned) the "Launch UriOrFile Action" method but i realised(by making experiments with various files on desktop and using internet url's) that i can only link the running wpf application with random files or internet sites and not to another wpf application as i wanted(when i put the path of the wpf application it pops up a window saying"windows explorer has stopped working",something that didnt occured when i put random file's paths or internet sites url's).If anyone understands my problem let me know!thanks!!
Check out Process.Start. Create a command that fires code that calls that method.

How to create a control like Solution Explorer in Visual Studio?

I want to create control that seems and works like the Solution Explorer of Visual Studio.
I mean not the functionality of solution explorer, the control should be seems like that control. That means, server explorer, toolbox, error List,... All these controls will pop-out when we put mouse and pop-in when we leave. We can lock and unlock those controls also.
So can anyone help me, to get the solution for this problem.
Thanks!!!!!!!!!!!
I am assuming you are using C#/VB.NET for development. The dockpanel suite will provide a docking framework for an application. Basically in terms of dockpanel, it is the forms which can be docked on the application using drag and drop like visual studio.
So create a treeview control in the form and dock it to the parent. You can populate the treeview control based on file directories or any specific needs of your project. Please note in dockpanel you create a form by not inheriting from Form class but from DockContent class. Documentation will give you more insight of how to create applications. It has a good example along with the source code in which it simulates the all the visual studio panes. It also provides and option to save the position of various docks which can act as a user preference. For eg, you may like to position solution explorer on left side whereas i may want it on right side. this get stored in a conf file which gets read next time when you start the application.
Incase you using MFC, then visual studio 2008 SP1 provides you with docking framwork and within that use the treeview control.
XAML also provides a docking framework. But i am not sure, you need to verify.
Win32 API does not have any native docking framework.

Custom silverlight user controls do not appear in Blend Assets tab

I've created a control in blend (xaml and code behind), saved it, and rebuilt the entire project. Now, not only does this new control not appear in the Assets tab in blend, none of the other user controls i've created appear either. I've rebuilt several times, blown away the obj and bin directories and rebuilt again, to no avail. How do I get my user controls to appear in the Assets pane so I can use them in my project?
thanks
Blend: 3.0.1927.0
VS: 9.0.30729.4108 QFE
.NET: 3.5 SP1
Sweeney,
I don't have the specifics of your install environment or applications installed, but using what I have, I can create a custom user control in blend and compile, pull it from my assets library, and put it on my page. Here are my specs, maybe you can check to see if you're running a different version or such:
Microsoft Expression Blend 2 Service Pack 1 - Version 2.1.1760.0
Microsoft Visual Studio 2008 - Version 9.0.30729.1 SP
Microsoft .NET Framework - Version 3.5 SP1
Here is what I did to create my custom control:
Open Blend.
Create new project (File > New Project..., Then named my Silverlight 2 Application, and clicked OK.)
Create new UserControl (File > New Item..., Then named my UserControl, and clicked OK.)
Create something like a colored background and text so that the control can be seen.
Build the application.
Add my custom control to the Page.xaml file from the Asset Library. (This may be where you got tripped up, please see below).
Size my new control.
Final product:
Screen Shot http://img163.imageshack.us/img163/7554/finalproduct.jpg
Accessing Custom Controls in Asset Library
Click the Asset Library icon (left side by default): Asset Library http://img43.imageshack.us/img43/2198/assetlibrary.jpg
Click the Custom Controls tab (top of Asset Library window): Custom Controls http://img5.imageshack.us/img5/8915/clickcustomcontrols.jpg
Select your custom control: Custom Control http://img693.imageshack.us/img693/1684/customcontrol.jpg
Place them on your page to your hearts content.
I hope this helps you,
Thanks!

Is any source code available that has an Active X control hosted in WPF?

I am looking for some source code and a project to download and look at that has an Active X control hosting WPF. I can not find any source code anywhere on the net.
I can not add a WPF resource the usual way in an Active X control. I have to add it manually to the reference section.
Not sure if this is even possible. I would check out WPF browser applications. That may be a better solution for you given that if you are going to be running an active x control with WPF the user will need 1) Internet Explorer and 2) .net 3.0+ installed locally. A WPF Browser application will work with IE if the user has .net 3.0+ installed and will work with IE and FireFox if the user has .net 3.5+ installed. Check out WPF Broswer Apps here: http://msdn.microsoft.com/en-us/library/aa970060.aspx
It should be possible, although I don't have the code for it off-hand. You can create an HwndSource, which allows a normal window to host WPF controls, in your ActiveX controls. Then it is only a matter of adding your WPF UI to that window.

Resources