Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1088007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:00:55+00:00 2026-05-16T23:00:55+00:00

I created a custom ToggleButton class, ToggleButtonEx, that extends ToggleButton. ToggleButtonEx contains some dependency

  • 0

I created a custom ToggleButton class, ToggleButtonEx, that extends ToggleButton. ToggleButtonEx contains some dependency properties that I created in order to use them in a template. I want to base the style of all of my radio buttons on the new toggle button style. Here is what I have:

The ToggeButtonEx style, which defines the template:

<Style TargetType="{x:Type local:ToggleButtonEx}">      
      <Setter Property="Template">
        <Setter.Value>
          <ControlTemplate TargetType="{x:Type local:ToggleButtonEx}">
...

The radio button style, based off of the ToggleButtonEx style:

<Style BasedOn="{StaticResource {x:Type local:ToggleButtonEx}}" TargetType="{x:Type RadioButton}">

This does not work though. According to msdn,

“If you create a style with a
TargetType property and base it on
another style that also defines a
TargetType property, the target type
of the derived style must be the same
as or be derived from the type of the
base style.”

Since radio button is derived from ToggleButton and not ToggleButtonEx, I can’t apply the style an I need the toggle button style to be based off of ToggleButtonEx or else I can’t use my custom dependency properties in the template. Is there a way to do this?

UPDATE:

Here is my requirement. Maybe someone can help with an alternate solution.

I want to display radio buttons as toggle buttons, so that they look like toggle buttons but maintain the radio button mutually exclusive functionality. This was not hard to do. I created a style targeting ToggleButton to set up my desired toggle button style and then created a new style targeting RadioButton which was based off of the toggle button style.

Now in my ToggleButton style, I change the ControlTemplate to make the button have rounded corners. I decided that I would like different buttons to have different CornerRadius’, or no rounding at all. I asked how that can be done in this post:

Inheriting/overriding WPF styles

One suggestion was to create a custom ToggleButton and add a new property so that it can be used in a TemplateBinding. I tried that but it looks like if it is possible, I am not doing it right. I would like to avoid adding a new style each time I need a different value of CornerRadius.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T23:00:56+00:00Added an answer on May 16, 2026 at 11:00 pm

    No, I don’t think there’s a way to do it unless maybe you derive a custom RadioButton from your ToggleButtonEx duplicating all the functionality existent in RadioButton. However I doubt that’s much fun – may not even be completely possible.

    However maybe we’d have some suggestions on how to solve your problem in another, slightly different way; you could try outlining the broad requirements that dictated the inclusion of a DependencyProperty? Maybe there’s even a built-in feature that can help you but nobody could think of suggesting it because nobody has any idea it might help you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am attempting to pull some information from my tnsnames file using regex. I
I notice in several API's, that you may create a struct which is used
I have several USB mass storage flash drives connected to a Ubuntu Linux computer
I have a snippet to create a 'Like' button for our news site: <iframe
I need to solve the following question which i can't get to work by
I'm trying to build a C++ extension for python using swig. I've followed the
There doesn't seem to be any tried and true set of best practices to
After having read Ian Boyd 's constructor series questions ( 1 , 2 ,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.