|
Basically, this property determines whether or not a hit test can take place against a visual element. This has the effect of selectively altering the visual tree for the purposes of hit testing. Here's an example - suppose you have a map, and you want to get the coordinates of a point on the map - but you don't want any pushpins on it to be included in the tests, then setting this to false for the pushpins means the hit test would take place against the map, and not any pushpins.
I hope that explains it.
|
|
|
|
|
Sort of.
I still don't understand what a HitTest is.
Everything makes sense in someone's mind
|
|
|
|
|
Ah. Imagine clicking on a point on the screen - the point you click at is the hit. It's a way of determining whether or not a control is affected by a click (perhaps you're writing a drag manager; and no this isn't your burly boss coming in wearing a dress)
|
|
|
|
|
Ok, I got it. So IsHitTestVisible="False" means the object does not responde to a hit test?
Everything makes sense in someone's mind
|
|
|
|
|
Yes. A reason to do this is because you might have layered your control over the top of another one, and set it so that it's invisible - it will intercept mouse clicks destined for the lower control unless you set the hit test to false.
|
|
|
|
|
ahh, ok. I get it.
Thanks
Everything makes sense in someone's mind
|
|
|
|
|
One more thing Kevin, and I apologise for not mentioning it. Setting IsHitTestVisible="false" on a container affects the children of the container as well. This is something to be very careful of because you can find that your hit testing doesn't behave quite the way you'd think it does by things higher up the tree. Here's a test for you to try:
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="HitTester.MainWindow"
x:Name="Window"
Title="Hit testable window"
Width="788" Height="621">
<Canvas IsHitTestVisible="False">
<Button Content="Button" Width="75" IsHitTestVisible="True" />
</Canvas>
</Window>
|
|
|
|
|
Ok, will do. Thanks
Everything makes sense in someone's mind
|
|
|
|
|
I'm so glad POH gave you a sensible answer b/c the first thing that I thought of was if someone smacks you in the face and you react then you have been hittested. A number of other facetious replies also occurred to me but you get the point.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Actually, my first thought was to post that it was an online exam for assassins.
|
|
|
|
|
You've been spending too much time in the Lounge listening to JSOP (and others)
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
This is the most Strangest error i have ever received from Silverlight. I have each control with its own name and i just added a Link button and a Menu item , i did a copy and paste of other items and renamed them from the xaml and i added a page that will be used by that menu item and i compiled the app and when i run it i get the following Error
Line: 54
Error: Unhandled Error in Silverlight Application
Code: 2028
Category: ParserError
Message: The name already exists in the tree: EchashDev.
File:
Line: 0
Position: 0
i tried googling and a lot of people are have different scenario which might be different from mine. I am not sure why Silverlight does not point to a problem element.
Thanks
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
I believe you've added two components with the same name (or key).
A simple search within the code may give you an idea.
Also trying cleaning your solution once.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
|
|
|
|
|
thanks for your reply. It was a bit complicated than that, the problem is now resolved , here was a problem.
i Had two Projects, opened. i was doing my demo on one project , so they liked it and i copied some controls and paste from one project to another and it created a reference and now it means the control exists in two projects that are linked so it caused a Conflict.
When i was typing some namespaces , i realised that there were namespaces that i did not create and i looked at the name of the demo project and i realised that i could access its object from another class. So i went to the References in the solution explorer and there was a dead reference marked with an exclation mark and i knew it was it.
its a lesson , don't copy controls between projects unless you copy code.
I see there is a duplicate post , please delete it. i think it was created when i lost connection trying to post the question.
thanks
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
modified on Friday, April 8, 2011 4:12 PM
|
|
|
|
|
We can't delete it, but you can. We'll leave it with no answers so you can remove it.
Good job on finding the solution.
|
|
|
|
|
Thank you , i just deleted the post.
kind Regards
Vuyiswa Maseko
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Thanks for posting the solution.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
|
|
|
|
|
You are Welcome
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
After programming WPF for sometime and reading so many articles[^] ... I'm still a little bit confused distinction between Logical and Visual Tree.
To simply put, my understanding is that Logical Tree is just a simplified version of Visual Tree! They are no different is just a way to confuse developers, they really should have one tree type - i.e. Visual Tree
And one additional property to let the guy decide if they need detail or not:
VisualTree.Mode = PresentationMode.Simple (i.e. LogicalTree) or PresentationMode.Complex (i.e. VisualTree)
Am I missing something here?
dev
|
|
|
|
|
You're missing quite a lot. While it may have been possible to combine the two types of trees, the resulting kludge would have been quite horrible.
Something that most people don't realise is that, while there is only one visual tree in a WPF application, there can be many logical trees. This is down to the purpose that they serve, and also covers the fact that the visual tree can only work with elements derived from Visual or Visual3D (hence it's name) while the logical tree can contain any type of object (and is one of the reasons that LogicalTreeHelper is not the most optimal way of walking the logical tree because it only walks DependencyObject elements. Without logical trees, it would be impossible for WPF/Silverlight to be able to use templates, for instance.
|
|
|
|
|
hi Peter, can you point me to a decent url? I been coding WPF for almost two years, didn't buy any book but did read quite numerous articles. Still in the dark.
thanks
dev
|
|
|
|
|
Josh Smith wrote an excellent article on the two. You can find it here[^].
|
|
|
|
|
I should have added that this is an excellent question - because the differences between the two are not very well explained in the documentation. Let me correct that voting oversight.
|
|
|
|
|
|