Can a WPF base class contain a control for a derived class?

Posted by Number8 on Stack Overflow See other posts from Stack Overflow or by Number8
Published on 2010-03-24T22:11:03Z Indexed on 2010/03/24 22:13 UTC
Read the original article Hit count: 202

Filed under:
|

Hello,
I have several UserControls that have some of the same controls doing the same job.
Is it possible to extract those controls into a base class?
When I have tried it, I get an error that the definition in the generated .g.cs file will hide the parent def.
What I would like to do:

public class ctlBase : UserControl
{
  internal CheckBox chkBox { get; set; }
}
In the .xaml of the derived class:  
<Grid>
  <CheckBox x:Name="chkBox" />
</Grid>
public class DerivedCtl : ctlBase
{  }

Thanks for any insights...

© Stack Overflow or respective owner

Related posts about wpf

Related posts about Silverlight