I have a RadTabControl, with 4 tabs.
Under each tab, I have a grid.
I want to set the grids to collapsed as default.
Then, upon "MouseLeftButtonDown" Event, I wish to SHOW the respective grid.
When I'm running the app, the grids hide, but MouseLeftButtonDown on the tab doesn;t do anything...
I did try another buttons click event, and it does make the grid in question show.
Thoughts?
Rich
3 Answers, 1 is accepted
RadTabItem handles its MouseLeftButtonDown event. That is why, you will have to attach a handler that receives MouseLeftButtonDown events even if they are handled.
tabItem.AddHandler(FrameworkElement.MouseLeftButtonDownEvent,
new
MouseButtonEventHandler(Item_MouseLeftButtonDown),
true
);
I have attached a sample project demonstrating this scenario. Give it a try and let me know how it works for you.
Best wishes,
Kiril Stanoev
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Howdy Kiril, and thanks for the reply.
Maybe it's b/c I'm a bit of a noob, but I'm getting a failure on line #13
tabItem.[AddHandler](FrameworkElement.MouseLeftButtonDownEvent, New MouseButtonEventHandler(Item_MouseLeftButtonDown), True)
My code(vb) is:
Public Sub New()
InitializeComponent()
For Each tabItem As RadTabItem In tabControl1.Items
tabItem.[AddHandler](FrameworkElement.MouseLeftButtonDownEvent, New MouseButtonEventHandler(Item_MouseLeftButtonDown), True)
Next
End Sub
Private Sub Item_MouseLeftButtonDown(ByVal sender As Object, ByVal e As MouseButtonEventArgs)
Me.VisualizeContent()
End Sub
Private Sub tabControl1_MouseLeftButtonDown(ByVal sender As Object, ByVal e As MouseButtonEventArgs)
Me.VisualizeContent()
End Sub
Private Sub VisualizeContent()
Dim tabItem As RadTabItem = TryCast(tabControl1.SelectedItem, RadTabItem)
TryCast(tabItem.Content, FrameworkElement).Visibility = Visibility.Visible
End Sub
Failure is:
Error 1 Delegate 'System.Windows.Input.MouseButtonEventHandler' requires an 'AddressOf' expression or lambda expression as the only argument to its constructor. D:\VisualStudioProjects\AEMR RequestForm\AEMRrequestForm\AEMRrequestForm\MainPage.xaml.vb 13 105 AEMRrequestForm
The line that says:
tabItem.AddHandler(FrameworkElement.MouseLeftButtonDownEvent,
new
MouseButtonEventHandler(Item_MouseLeftButtonDown),
true
);
tabItem.
AddHandler
(FrameworkElement.MouseLeftButtonDownEvent,
New
MouseButtonEventHandler(
AddressOf
Me
.Item_MouseLeftButtonDown),
True
)
I am attaching a converted version of the previous example. Let me know if this is of any help.
All the best,
Kiril Stanoev
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.