.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Cross Reference in the Visual Tree

Posted By:      Posted Date: September 24, 2010    Points: 0   Category :WPF

Hi all , I have some problem when I want to make some visual element in my user control to static . 

I found it is because the visual in the visual tree can only have 1 parent , if rendered a new user control , the old one will lose the static elements .

Do you have any idea that I can share the static element in the user controls ?


View Complete Post

More Related Resource Links

Visual Studio 2008 Cross Reference Problem


Hi to all

I got following warning when I opens my solution...

Warning 1 There is a circular reference involving the import of file "C:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.CompactFramework.CSharp.targets". This file may have been imported more than once, or you may have attempted to import the main project file. All except the first instance of this file will be ignored. EM.ShoppingCart

"There is a circular reference involving the import of file "C:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.CompactFramework.CSharp.targets". This file may have been imported more than once, or you may have attempted to import the main project file. All except the first instance of this file will be ignored."

I got this error after my VS 2008 crashed three times and after every crash it got restarted and made backup. So three back ups are made in my solution folder... when I got the above mentioned error I moved all the backups from solution but i cant get rid of it....

Thank you;

Logical- and Visual Tree

Elements of a WPF user interface are hierarchically related. This relation is called the LogicalTree. The template of one element consists of multiple visual elements. This tree is called the VisualTree. WPF differs between those two trees, because for some problems you only need the logical elements and for other problems you want all elements.

Viewing the Visual Tree in the Debugger

I recently posted an article to CodeProject which discusses a debugger visualizer.  It allows you to view the visual tree while debugging, inspect every property of any element in the tree, as well as view a snapshot image of any element.  I call it Woodstock, because it's like a scaled down version of Snoop.  Here's the article, if you're interested: http://www.codeproject.com/useritems/WoodstockForWPF.asp

visual tree hit test not working

I have a sketch/designer type of program. The user can sketch shapes. These shapes are polygons in a user control. I have an edge and a vertex class which generate the point collection for my polygons and connect the vertices to outline the polygon. I am using a selection box in an adorner to selection those controls and move them around. When I release the mouse after drawing the selection box, I run a hit test by calling VisualTreeHelper.HitTest. I pass in new     GeometryHitTestParameters(new RectangleGeometry(rect)) where the rectangle is the selection box, and this chooses the appropriate shapes. The user can take the selected shapes and "join" them to unselected shapes. In this situation. The shapes still remain in separate user controls, but they now share the common edges and vertices. At this point, my selection stops working intermittently. When I try to debug my hit test, I never hit the break points in my HitTestFilterCallback, HitTestResultCallback, or in my overridden HitTestCore functions. Then if I drag an edge or vertex, the selection may or may not start working again. I am not even sure how to debug this type of problem anymore. I have checked the visual tree for the canvas holding my shape controls and everything seems right.   Please help.  

Sharepoint check-out document cross reference problem

Hi I have a problem with check-outed word document from Sharepoint Services 3.0. After I check-out document from Sharepoint, cross references in Word document stop working. After I click to cross reference (Ctrl+Click to follow link), Word show me warning message: "Some files can contain viruses or otherwise be harmful to your computer...Would you like to open this file". There is two buttons - OK and cancel. After pressing OK nothing happens. I have Sharepoint Services 2003 (clear installation, no custom code), MS Word 2007 and trying .doc file format. I tried this on two Sharepoints and two client computers, but it is the same. I tried http://support.microsoft.com/?scid=kb%3Ben-us%3B925757&x=8&y=9 , but did not help. How can I disable this behavior? Thanks

How to add Sharepoint dll reference to Windows Forms application project in Visual Studio 2010?

Hi,I am using Windows Forms application template in Visual Studio 2010 Beta. I created this for some R & D work. Now I am using Sharepoint object model in application. When I am trying to add Sharepoint dll reference from .NET tab, I can not see Windows Sharepoint Services there Which was available in Visual Studio 2005.Also If I am add this sharepoint dll from ISAPI folder (14 Hive), it is added succesfully, but it is not taking actually in project and showing me an error during running mode that theError 12 The type or namespace name 'SharePoint' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) Please suggest me how to add Sharepoint dll reference in Windows forms application in Visual Studio 2010?

wpfperf tool Visual Profiler not populating element tree

I'm trying to use the latest version of the Performance Profiling Tools for WPF that are listed here: http://windowsclient.net/wpf/perf/wpf-perf-tool.aspx#profiler

For some reason the element tree is not being populated when I start my app using the Launch Process.  I do see the chart for Application CPU Usage update and scroll by, however I would like to see which elements in particular are eating up CPU time.

Does anyone have a solution?

Add Web reference in Visual Studio 2008 fails with Access denied error


i am trying to add a wsdl file to a C# project by using Add Web Reference utility but the tool fails with the error access denied to the path .. is denied. quite not sure where to check the params. any help would be appreciated.

Visual tree with collapsed elements -Performance



I have a very large and deep visual tree.I had an issue with tab switch .It use to build the visual elements when the focus is on a tab and then drop those elemnts when you move away from the tabs.

To overcome this performance challenge I stop dropping and adding the visual elemnts when tab is switched I just made it "collapsed".

Though now the tree is huge but it should not hit performance.

Are you aware of any performance if you have large visual tree with collapsed elemnts .Is it better or worse or same as those collapsed elements not in the tree.


Can not add assembly reference and using .dll file from Visual studio 2008 and 2010 Type 'LibraryN


Hi all,

Please tell me the way to solved my problem to looking for a long time.

My System Info:

OS: Windows 7 - Ultimate - 64bit

VS: Visual Studio 2008 - Professional (and problem with my VS2010 installed)


I have a small project and build it to library .dll file with some function util.

From an other website (with diffirence solution). I added reference the .dll before to website.

In website, I declaration to using the function in library (dll file before). But I found error:  Error 1 Type 'LibraryName' is not defined.

And in VS2010 the problem is same.

But, run website on an other computer, it work normally.

Thanks and Best regards.

How to pull out the whole tree of the FK reference by CTE?


Hello Guys:

I am trying to get all tables recursively who refer the one table , supposing to say "ta" by CTE as belows.

		with CTE(Constraint_object_ID, Constraint_column_ID,HierarchyID,
					tableName,FKColumn,ParentTable,PKColumn) as 
		select Constraint_object_ID,Constraint_column_ID ,HierarchyID=1,
		from sys.foreign_key_columns FK
				inner join sys.columns C1
		on FK.referenced_Object_ID=C1.object_ID and FK.referenced_Column_ID=C1.Column_ID
				inner join sys.columns C2
		on FK.parent_Object_ID=C2.object_ID and FK.parent_Column_ID=C2.Column_ID
		where object_name(referenced_object_ID)='ta' 
		union all
				select CTE.Constraint_object_ID, CTE.Constraint_column_ID,HierarchyID=HierarchyID+1,
					tableName,FKColumn,ParentTable,PKColumn from CTE inner join sys.foreign_key_columns FK
					on CTE.tableName=object_name(FK.referenced_object_ID)
			select * from CTE 
			order by Constraint_object_ID, Constraint_column_ID

While it reports an error like this "The statement terminated. The maximum recursion 100 has been exhausted before statement completion.", I doubt a bit that soemthing wrong in my T-SQL however I did not figure out "where" yet.


How can I force the visual tree to load


I have a tab control and it's not loading the controls on any of the hidden tabs until the user clicks on that tab. But I have code when the form first opens that's walking the visual tree setting properties on various controls.  But since it can't see what's not loaded yet, the properties don't get set. And then when the user switches to that tab, they're not rendering correctly.

How can I force the tab control, expander control, etc to force load their visual tree?


Parsing string as a Button type reference in Visual c#


So basically, id like to parse the name of a string as an Button reference, and then alter the properties of that particular button with the reference being the same as the string parsed.

something like

Button b101 = new Button();





 private void boxlight(Button obj)
            obj.BackColor = Color.RED;


however explicit type casting for this conversion is not supported.



Sharepoint Checked Out Word Document Cross Reference Error on Page number Only



I see the same error as RHABALA reported in an earlier thread, after I check out my Word Document from Sharepoint into Word 2010. 

When I Control-click on any of my Cross References to Page Number, they fail with the warning prompt, they seem to be incorrectly pointing at the Sharepoint path. But when I Control-click an any Cross References to Paragraph Numbers,  they still work. I've added my Sharepoint Site to the trusted list in Internet Explorer, as recommended in that thread, but no difference, the error persists.

Grateful for your assistance.


sharepoint 2010 custom webservice, visual studio 2010, unable to get reference - content type is tex


I followed the MSDN example in how to create a custom webservice that integrates with sharepoint at http://msdn.microsoft.com/en-us/library/ms464040.aspx

I'm able to successfully call the custom webservice it walks you through from internet explorer out of a sharepoint 2010 site using a URL such as http://vm-spproduction/sites/resource/_vti_bin/service.asmx

And, I'm able to successfully call the same custom webservice from internet explorer out of the same sharepoint 2010 server with the URL http://vm-spproduction/_vti_bin/service.asmx

In Visual Studio 2010 (running on the same hardware server as sharepoint 2010), I am able to bring up the same custom webservice in the add web reference using the advanced buttons of the add service reference dialog.  But, when the custom webservice is found, visual studio reports the following error:

The document at the url http://vm-spproduction/sites/resource/_vti_bin/service.asmx was not recognized as a known document type.
The error message from each known type may help you fix the problem:
- Report from '

Visual Studio 2005 C# refuses to accept x64 C++ activex control as reference



Firstly: Sorry about my English.


I have many 32bit OCXs, they work fine on x86. But! When I rebuild them on x64, there is an error.

I can not use one of them.

On the developer machine is a Windows xp x64 professional and Visual Studio 2005 sp1.

So, I register the COM control, and after it i can make an instance in ActiveX Test Container (x64) but in VS2005 i can not use this com control. It is not in COM tab page and when i browse the abc.ocx, VS2005 refuses it...

Error message is the next:

A reference to the "...." could not be added.Please make sure that the file is accessible and that it is a valid assembly or COM component.

This contol is a visual control (shows pictures, resize them, ...) and the others are not.

A better way to reference your wizard steps using named steps

Note: this article uses the plain vanilla but the concepts apply equally well to its popular counterpart .

By far the most common way that I see wizard steps reference in code snippets is by their index.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend