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. WPF Radio Button Group Behavior

WPF Radio Button Group Behavior

Scheduled Pinned Locked Moved WPF
csharpwpfwinformsquestion
2 Posts 2 Posters 0 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.
  • E Offline
    E Offline
    Eric Woodruff
    wrote on last edited by
    #1

    Is there a way to make radio button groups behave as they do in Windows Forms? By that I mean when you hit tab, the focus moves to the next control following the group rather than the next radio button in the group and when you use the up and down keys, the checked state follows the selected radio button rather than having to hit space to select it. Thanks. Eric

    S 1 Reply Last reply
    0
    • E Eric Woodruff

      Is there a way to make radio button groups behave as they do in Windows Forms? By that I mean when you hit tab, the focus moves to the next control following the group rather than the next radio button in the group and when you use the up and down keys, the checked state follows the selected radio button rather than having to hit space to select it. Thanks. Eric

      S Offline
      S Offline
      SledgeHammer01
      wrote on last edited by
      #2

      The arrow keys one is a simple fix. Just add a trigger that targets the RadioButton control. Something like: <Style.Triggers> <Trigger Property="IsKeyboardFocusWithin" Value="True"> <Trigger.Setters> <Setter Property="IsChecked" Value="True" /> </Trigger.Setters> </Trigger> </Style.Triggers> As for the tab one... thats a little bit trickier. I don't really feel like writing code on a Saturday night, but if I was, I'd probably derive a class from RadioButton, override the key down and if its a tab, I'll search for the next control thats either not a radio button or not in the group. Keep in mind that shift-tab should work the other way :). Previous control I mean. I don't think you can fix that in xaml.

      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