Declined
Last Updated: 11 Aug 2016 14:04 by ADMIN
ADMIN
Telerik Admin
Created on: 22 Apr 2011 11:54
Category: TabControl
Type: Bug Report
10
TabControl: Content's Loaded event is fired twice in WPF
Loaded event of the RadTabItem's content is fired twice in WPF.

Declined: The behaviour is caused due to the way how the WPF framework operates with ContentControl and their Content property(the RadTabItem is HeaderedContentControl which derives from ContentControl). The Content property is automatically registered to the LogicalTree when it is set, this is causing the first loaded event to be fired. After a selection is made the RadTabControl inserts/visualizes the Content of its selected RadTabItem in its ContentPresenter, this causes the control to fire its loaded event as it is loaded into the VisualTree.

private void Content_Loaded(object sender, RoutedEventArgs e)
{
	if (VisualTreeHelper.GetParent(sender as DependencyObject) != null)
	{
		// Execute the logic for LoadedEvent.
	}
}
0 comments