Hi Pavan
You can find child from StackPanel with this function which is given here
http://msdn.microsoft.com/en-us/library/system.windows.frameworktemplate.findname%28v=vs.110%29.aspx[
^]
private childItem FindVisualChild<childitem>(DependencyObject obj)
where childItem : DependencyObject
{
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++)
{
DependencyObject child = VisualTreeHelper.GetChild(obj, i);
if (child != null && child is childItem)
return (childItem)child;
else
{
childItem childOfChild = FindVisualChild<childitem>(child);
if (childOfChild != null)
return childOfChild;
}
}
return null;
}
and call following code on your button click -
object obj = FindVisualChild<mycan>(stkm);
If you will add more than one child items into the stakpanel then give "Name" to each child item and check inside "FindVisualChild" function with "Name" property.