Click here to Skip to main content
15,879,326 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
i am using this VisualTreeHelper.GetChildrenCount(obj)method and passing list box as object parameter..when that list box is in first tabitem of tabcontrol the
MIDL
System.Windows.MessageBox.Show(VisualTreeHelper.GetChildrenCount(obj).ToString());

Message box show output is 1 and

when that list box in second tab item then it show output in message box is 0 why this happen ..

in actual scenario i am using project http://www.codeproject.com/KB/IP/WCFWPFChatRoot.aspx (WCF chat application) in my application where in my application there is 5 tab item and i amproviding this chat function on 2nd tab..but its connect but not switch to chatting list box control..when i put this application on first starting tab then its work fine...but switch to other tab rather than first give same error..please help me.
Posted
Updated 23-May-11 19:06pm
v2
Comments
Wayne Gaylard 23-May-11 5:49am    
What are you passing into the function as obj? Are you sure you are assessing the same control both times ? This function just returns an integer giving the number of visual elements contained within the original visual object. Are you sure this is what you were intending ? You need to provide more detail to get any meaningful help.
vishal_h 24-May-11 1:03am    
sir i am actually using this project http://www.codeproject.com/KB/IP/WCFWPFChatRoot.aspx (WCF chat application) in my application where in my application there is 5 tab item and i amproviding this chat function on 2nd tab..but its connect but not switch to chatting list box control..when i put this application on first starting tab then its work fine...but switch to other tab rather than first give same error..please help me..
Sergey Alexandrovich Kryukov 23-May-11 9:44am    
Yes, not quite clear. Show XAML as well; do you provide a template for the control?
--SA

1 solution

Do the tabs have names?
Once you get the list of children, you can look at the names and perform appropriate actions.
 
Share this answer
 
Comments
vishal_h 24-May-11 1:33am    
but sir i am not getting the name of tab...and when i put that application on start tab its work fine..i also try to replace window load code tab index changed event of that tab..but not work

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900