KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
The following WPF UserControl called DataTypeWholeNumber which works. Now I want to make a UserControl called DataTypeDateTime and DataTypeEmail , etc. Many of the Dependency Properties will be shared by all these controls and therefore I want to put their common methods into a BaseDataType and have each of these UserControls inherit from this base type. However, when I do that, I get the error: Partial Declaration may not have different base classes . So how can I implement inheritance with UserControls so shared functionality is all in the base class? using System.Windows; using System.Windows.Controls; namespace TestDependencyProperty827.DataTypes { public partial class DataTypeWholeNumber : BaseDataType { public DataTypeWholeNumber() { InitializeComponent(); DataContext = this; //defaults TheWidth = 200; } public string TheLabel { get { return (string)GetValue(TheLabelProperty); } set { SetValue(TheLabelProperty, value); } } public static readonly DependencyProperty TheLabelProperty = DependencyProperty.Register("TheLabel", typeof(string), typeof(BaseDataType), new FrameworkPropertyMetadata()); public string TheContent { get { return (string)GetValue(TheContentProperty); } set { SetValue(TheContentProperty, value); } } public static readonly DependencyProperty TheContentProperty = DependencyProperty.Register("TheContent", typeof(string), typeof(BaseDataType), new FrameworkPropertyMetadata()); public int TheWidth
Tags (comma-separated)
Save Edits
Cancel