Création d'une classe de base pour les ChildWindow
Bonjour à tous,
Dans mon projet j'ai souvent besoin d'afficher du contenu html. Je sépare donc généralement mon UI en 2, à gauche mon Silverlight et a droite mon html par exemple.
Le problème survient lorsque j'ai une ChildWindow à afficher, en effet, impossible de superposer du Silverlight sur mon contenu html il faut donc que je décale l'affichage de ma Childwindow sur la gauche afin d’empêcher toute superposition.
Comme je me suis fait plein de controls childWindows différents (loading, confirmation, error...) je voudrais faire une BaseChildWindow héritant de ChildWindow contenant une méthode me permettant de pousser vers la gauche l'affichage de ma childWindow :
Code:
1 2 3 4 5
| public void DisplayToTheLeft() {
this.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
double _left = (Application.Current.Host.Content.ActualWidth * 0.6 / 2) - (this.ActualWidth / 2);
this.Margin = new Thickness(_left, 0, 0, 0);
} |
Ensuite je ferai hériter toutes mes autres childWindows de ma BaseChildWindow afin qu'ils puissent tous utiliser la méthode DisplayToTheLeft mais si je fait par exemple :
Code:
1 2 3 4 5 6 7 8
| public partial class LoadingChildWindow : BaseChildWindow
{
public LoadingChildWindow(string _loadingMessage)
{
InitializeComponent();
Tb_Loading.Text = _loadingMessage;
}
} |
J'ai une erreur :
Citation:
Partial declarations of 'Cybergo.Controls.LoadingChildWindow' must not specify different base classes
Car j'ai une classe partiel générée qui elle descend toujours de ChildWindow :calim2:
Où est-ce que je m'y prend mal ?? Le fait de vouloir factoriser ce code est pourtant logique non ?