Hello,
I've created a custom control of XamDateTimeEditor :
Here is the class code :
public class DateTimeEditor : XamDateTimeEditor { /// <summary> /// Constructeur. Place les modifications pour l'application /// </summary> public DateTimeEditor() : base() { this.Initialized += new EventHandler(DateTimeEditor_Initialized); } void DateTimeEditor_Initialized(object sender, EventArgs e) { this.Language = XmlLanguage.GetLanguage("fr-FR"); this.FormatProvider = CultureInfo.CurrentCulture.DateTimeFormat; //Traduction du bouton en bas pour aujourd'*** Infragistics.Windows.Editors.Resources.Customizer.SetCustomizedString("TodayButtonCaption", "Aujourd'***: " + DateTime.Now.ToShortDateString()); this.Visibility = Visibility.Visible; } static DateTimeEditor() { DefaultStyleKeyProperty.OverrideMetadata(typeof(DateTimeEditor), new FrameworkPropertyMetadata(typeof(DateTimeEditor))); } }
My problem : on runtime, the datetime editor is not visible whereas it is when using Xam designer mode.
Can anybody help me ?
You may want to refer to Microsoft's documentation on authoring controls. When you set the DefaultStyleKey you are expected to provide the default style for the control. I'm guessing that you did not create a template for your control and that is why you don't see anything when you site your control. If you want to go down this route then you can copy the default template/style for the xamDateTimeEditor ( the default xaml is provided in the DefaultStyles directory ).