Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. TabControl: WinForms Vs WPF

TabControl: WinForms Vs WPF

Scheduled Pinned Locked Moved WPF
csharpwpfquestionvisual-studiowinforms
4 Posts 3 Posters 4 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    yanairon
    wrote on last edited by
    #1

    Hi, does anybody knows what is the WPF way to avoid Tab Selection? in WinForms i had the Selecting event which i could cancel (with CancelEventArgs) btw, is there any source of the net that gives you the deifferences? i found this great document: Wpf for those who knows WinForms[^] But it doesn't cover everything, just Layouts, Binding and some general issues (Form Vs Window etc.) i would love to get other sources like that :) thanks,

    L A 2 Replies Last reply
    0
    • Y yanairon

      Hi, does anybody knows what is the WPF way to avoid Tab Selection? in WinForms i had the Selecting event which i could cancel (with CancelEventArgs) btw, is there any source of the net that gives you the deifferences? i found this great document: Wpf for those who knows WinForms[^] But it doesn't cover everything, just Layouts, Binding and some general issues (Form Vs Window etc.) i would love to get other sources like that :) thanks,

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Read up on Preview events and the cancelling of them. This code in effect cancels the mouse click so that the tab selection will not take place. You can get access to the tabitem that was click from the e.OriginalSource and then perform you logic to cancel the mouse click or not.

      Private Sub tcOpenPages_PreviewMouseLeftButtonDown(ByVal sender As Object, _
      ByVal e As System.Windows.Input.MouseButtonEventArgs) _
      Handles tcOpenPages.PreviewMouseLeftButtonDown

      Dim bolCancelTabSelection As Boolean = False
      
      'write some code to set bolCancelTabSelection
      
      If bolCancelTabSelection Then
          e.Handled = True
      End If
      

      End Sub

      Cheers, Karl » CodeProject 2008 MVP » Microsoft MVP - Client App Dev My Blog | Mole's Home Page | MVP Profile

      Just a grain of sand on the worlds beaches.

      1 Reply Last reply
      0
      • Y yanairon

        Hi, does anybody knows what is the WPF way to avoid Tab Selection? in WinForms i had the Selecting event which i could cancel (with CancelEventArgs) btw, is there any source of the net that gives you the deifferences? i found this great document: Wpf for those who knows WinForms[^] But it doesn't cover everything, just Layouts, Binding and some general issues (Form Vs Window etc.) i would love to get other sources like that :) thanks,

        A Offline
        A Offline
        Ajay k_Singh
        wrote on last edited by
        #3

        I believe you should be able to use SelectionChanged event of TabControl. Such as- -------------------------- void tb1_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (e.RemovedItems[0] == TbPage1) { MessageBox.Show(""); } //throw new NotImplementedException(); } ------------------------- -Ajay.

        ------------------------- www.componentone.com -------------------------

        Y 1 Reply Last reply
        0
        • A Ajay k_Singh

          I believe you should be able to use SelectionChanged event of TabControl. Such as- -------------------------- void tb1_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (e.RemovedItems[0] == TbPage1) { MessageBox.Show(""); } //throw new NotImplementedException(); } ------------------------- -Ajay.

          ------------------------- www.componentone.com -------------------------

          Y Offline
          Y Offline
          yanairon
          wrote on last edited by
          #4

          but in SelectionChanged you can't cancel the selection, only add stuff to when it's happening

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups