In my DayView control "owner"s are Work Crews. I show crew name and a count of crew members as the owner name property shown on the control's header
I have mapped the control's header double click to edit my crew
When the edit is done. I need to refresh the header to show the correct count/crew name
this updates the value: ucInfo.Owners(0).Name = sCrew + ": " + Str(iCrewMembers)
I tried calling uDayView.Refresh() but the updated value still does not show.
Help??
Awesome. Works Great. Thanks
Are you using a custom draw filter to achieve this display change? If you are not then i highly suggest using one rather then changing the owners name... leave the crew name "as is" such as "CREW1"
and using a custom draw filter... change the header display to: "CREW1" & CrewNames
Implementing a DrawFilter is DEFINATELY a better solution (in my not so humble opinion).... to do so....
Create THIS custom Class.
Public Class OwnerDrawFilter Implements IUIElementDrawFilter Public Function GetPhasesToFilter(ByRef drawParams As Infragistics.Win.UIElementDrawParams) As DrawPhase Implements IUIElementDrawFilter.GetPhasesToFilter Dim OwnerHeaderElement As OwnerHeaderUIElement = TryCast(drawParams.Element, OwnerHeaderUIElement) If OwnerHeaderElement IsNot Nothing Then Return DrawPhase.BeforeDrawElement Else Return DrawPhase.None End If End Function Public Function DrawElement(ByVal drawPhase As Infragistics.Win.DrawPhase, ByRef drawParams As Infragistics.Win.UIElementDrawParams) As Boolean Implements IUIElementDrawFilter.DrawElement Dim OwnerHeaderElement As DayView.OwnerHeaderUIElement= TryCast(drawParams.Element.GetDescendant(GetType(DayView.OwnerHeaderUIElement)), DayView.OwnerHeaderUIElement) If OwnerHeaderElement IsNot Nothing Then Dim textelement As TextUIElement = TryCast(OwnerHeaderElement.GetDescendant(GetType(TextUIElement)), TextUIElement) ' Get the Owner associated with the element that is being drawn Dim own As Owner = TryCast(OwnerHeaderElement.GetContext(GetType(Owner)), Owner) Try If textelement IsNot Nothing Then textelement.Text = own.Name & " (" & FUNCTIONTOGETYOURCREWMEMBERNAMESANDCOUNT.ToString & ")" textelement.Rect = textelement.Parent.RectInsideBorders Exit Function Catch ex As Exception Exit Function End Try End If End Function
TAKE NOTE:in the above class there is a function you will have to write... FUNCTIONTOGETYOURCREWMEMBERNAMESANDCOUNTI suggest storing this string in your OWNERS.TAG (If it is not already being used for something else)
EG: when your crew gets edited... instead of changing the Name of your owner.... do the following:
Owner.Tag = "This is my new members names... There are 10 of us in the crew blah blah" (A shorter one is advisable )
Then Simply instead of writing a function as suggested above... just do the following in the above class:If textelement IsNot Nothing Then textelement.Text = own.Name & " (" & Owner.Tag.ToString & ")"
ON YOUR FORM WHICH HAS THE DAYVIEW CONTROL...
Instantiate a new object of your new class and declare it publicly to your form.
Public CustomDrawFilter As New OwnerDrawFilter() In the form_load event do the following:
Me.UltraDayView1.DrawFilter = CustomDrawFilter
I hope this helps and proves to be a more elegent solution for you. Let me know :)
CheersAaron
Sorry for the slow response time. I've been working on other things
That didn't work for me.
I am guessing because there is no DayHeaderUIElement in the UIElement.ChildElements collection
Any other ideas?
Me.UltraDayView1.UIElement.DirtyChildElements(True)
This forces to the creation filter to fire immediately