Note that there are some explanatory texts on larger screens.

plurals
  1. POCustom Image Button and Radio/Toggle Button from Common Base Class
    text
    copied!<p>I would like to create a set of custom controls that are basically image buttons (it's a little more complex than that, but that's the underlying effect I'm going for) that I've seen a few different examples for. However, I would like to further extend that to also allow radio/toggle buttons.</p> <p>What I'd like to do is have a common abstract class called ImageButtonBase that has default implementations for ImageSource and Text, etc. That makes a regular ImageButton implementation pretty easy.</p> <p>The issue I am having is creating the RadioButton flavor of it. As I see it, there are at least three options: </p> <ol> <li>It would be easy to create something that derives from RadioButton, but then I can't use the abstract class I've created. </li> <li>I could change the abstract class to an interface, but then I lose the abstract implementations, and will in fact have duplication of code. </li> <li>I could derive from my abstract class, and re-implement the RadioButton-type properties and events (IsChecked, GroupName, etc.), but that certainly doesn't seem like a great idea.</li> </ol> <p>Note: I have seen <a href="https://stackoverflow.com/questions/2362641/how-to-get-a-group-of-toggle-buttons-to-act-like-radio-buttons-in-wpf">How to get a group of toggle buttons to act like radio buttons in WPF?</a>, but what I want to do is a little more complex.</p> <p>I'm just wondering if anybody has an example of an implementation, or something that might be adapted to this kind of scenario. I can see pros and cons of each of the ideas above, but each comes with potential pitfalls.</p> <p>Thanks, wTs</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload