I have an application that can display items in two different ways, in rows using a StackPanel or icons using a WrapPanel. Which way it displays these items depends on a config setting. To populate these panels I have two seperate classes one inherits from the WrapPanel the other from the StackPanel. I was able to cut down on duplicated code using an Inferface. However I still had a lot of duplicated code the only difference between the code is the references to StackPanel or WrapPanel.
What I would really like to do is create a class that inherits from either the StackPanel or WrapPanel depending on the config setting.
public class ContainerBase : <wrap or stack>
{
//Do stuff!
}
Is this possible? Am I approaching this incorrectly?