Hello,
I am trying to access the editor used to display appointments on the timelineview for each appointment. The reason I am trying this is because i want to set the barheight for each appointment differently. I know it is possible, I just want to know which direction I should go (overwriting the creationFilters method or any other way).
Thank you!
I have tested but this code not work because TimeSlotUIElement is not parent of AppoitmentUIElement
Ok, here is the code. This will fill all the Area in the TimeSlotUI. If you want just to make it as high as the time slot, then set your appointment width accordingly.
bool IUIElementCreationFilter.BeforeCreateChildElements(UIElement elem)
{
if (elem is Infragistics.Win.UltraWinSchedule.TimelineView.AppointmentUIElement)
Infragistics.Win.UltraWinSchedule.TimelineView.TimeSlotUIElement parent = elem.GetAncestor(typeof(Infragistics.Win.UltraWinSchedule.TimelineView.TimeSlotUIElement));
elem.Rect = new Rectangle(parent.Rect.X, parent.Rect.Y, parent.Rect.Width, parent.Rect.Height);
}
return false;
Hope it helps!
Could you help me how to make an Appointment dock fill in TimeSlotUIElement?
Hello!
Well, first of all you should not create the TextUIElement inside the TimeSlotElement, create it inside the AppointmentUIElement.
if (parent is Infragistics.Win.UltraWinSchedule.TimelineView.AppointmentUIElement) !!!!!
Second, why use the EmbeddedButtonClicked event this way? Do what you have to do at the ElementClick event. I'm not saying your way does not work...
Try this:
pnchung said:public void AfterCreateChildElements(UIElement parent) { if (parent is Infragistics.Win.UltraWinSchedule.TimelineView. AppointmentUIElement) TextUIElement txtUI = new TextUIElement(parent,"The Text here"); txtUI.Rect = new Rectangle(parent.Rect.X+5, parent.Rect.Y+5, 40, 60); txtUI.BorderSides = Border3DSide.All; txtUI.BorderStyle = UIElementBorderStyle.RaisedSoft; txtUI.Text = "This should now show show"; txtUI.ElementClick += new UIElementEventHandler(OnEmbeddedButtonClicked); parent.ChildElements.Add(txtUI); } } protected virtual void OnEmbeddedButtonClicked(object sender, UIElementEventArgs e) { MessageBox.Show("clicked on the Label.") ; }
Thank you for your quick reply!
But when I add a TextUIElement to the TimeSlotUIElement, it not show on the TimeLineView, the click event also not fire, please help me,the codeis this:
public void AfterCreateChildElements(UIElement parent) { if (parent is Infragistics.Win.UltraWinSchedule.TimelineView.TimeSlotUIElement) TextUIElement txtUI = new TextUIElement(parent,"The Text here"); txtUI.Rect = new Rectangle(parent.Rect.X+5, parent.Rect.Y+5, 40, 60); txtUI.BorderSides = Border3DSide.All; txtUI.BorderStyle = UIElementBorderStyle.RaisedSoft; // txtUI.Text = "This also not show"; txtUI.ElementClick += new UIElementEventHandler(OnEmbeddedButtonClicked); parent.ChildElements.Add(txtUI); } } public event UIElementEventHandler EmbeddedButtonClicked; #endregion EmbeddedButtonClicked event #region OnEmbeddedButtonClicked protected virtual void OnEmbeddedButtonClicked(object sender, UIElementEventArgs e) { if (this.EmbeddedButtonClicked != null) this.EmbeddedButtonClicked(sender, e); }And code in the main form:< private void Form1_Load(object sender, EventArgs e) { EmbeddedButtonCreationFilter1 filter = new EmbeddedButtonCreationFilter1(); filter.EmbeddedButtonClicked += new UIElementEventHandler(this.filter_EmbeddedButtonClicked); this.ultraTimelineView1.CreationFilter = filter; } private void filter_EmbeddedButtonClicked(object sender, Infragistics.Win.UIElementEventArgs e) { MessageBox.Show("clicked on the Label.") ; }