Hi,
i had tried lots of time but i am unable to add Header Text in XamdayView.
also there is no help on internet at all.
Please help.
Previously i had posted a question but it seems infragistics guys are very busy, and unable to sort out problems of there customers.
nandlaldotsquares said:i am unable to add Header Text in XamdayView
Thanks a lot, you replied.
Here is my code used to show calendar
XamDayView optiomDayView = new XamDayView(); optiomDayView.FontSize = (double)10; optiomDayView.CalendarDisplayMode = CalendarDisplayMode.Overlay; optiomDayView.ShowCalendarCloseButton = true; optiomDayView.ShowCalendarOverlayButton = true; DataSet myDataSet = new DataSet(); myDataSet = loadDayPage(item.Id.ToString()); ListScheduleDataConnector mydataConnector = new ListScheduleDataConnector(); mydataConnector.ResourceItemsSource = CreateResources(item, i); mydataConnector.ResourceCalendarItemsSource = GetCurrentCalendar(item, i); mydataConnector.AppointmentItemsSource = CreateAppointments(myDataSet); // Create a XamScheduleDataManager object and set its DataConnector property. XamScheduleDataManager mydataManager = new XamScheduleDataManager(); mydataManager.ActivityDialogDisplaying += new EventHandler<ActivityDialogDisplayingEventArgs>(mydataManager_ActivityDialogDisplaying); mydataManager.DataConnector = mydataConnector; // Create a CalendarGroupCollection object to add CalendarGroup objects. CalendarGroupCollection mycalendarGroupCollection = mydataManager.CalendarGroups; CalendarGroup mycalendarGroup = new CalendarGroup(); mycalendarGroup.InitialCalendarIds = "[res" + i.ToString() + "[cal" + i.ToString() + "]]"; //mycalendarGroup.InitialCalendarIds = "[res" + i.ToString() + "[cal1][cal2][cal3][cal4]]"; mycalendarGroupCollection.Add(mycalendarGroup); optiomDayView.DataManager = mydataManager; optiomDayView.VisibleDates.Clear(); optiomDayView.VisibleDates.Add(Convert.ToDateTime(dtdate.SelectedDate));
and This is code for resource
private ObservableCollection<Resource> CreateResources(customCB item, int Number) { ObservableCollection<Resource> _rcCollection = new ObservableCollection<Resource>(); Resource rc = new Resource(); rc.Id = "res" + Number.ToString(); rc.Name = item.fullName; rc.IsLocked = false; rc.IsVisible = true; rc.Description = item.fullName; _rcCollection.Add(rc); return _rcCollection; }
and this is for Calendar
private ObservableCollection<ResourceCalendar> GetCurrentCalendar(customCB item, int Number) { ObservableCollection<ResourceCalendar> _rcCollection = new ObservableCollection<ResourceCalendar>(); ResourceCalendar rc = new ResourceCalendar(); rc.Id = "cal" + Number.ToString(); rc.OwningResourceId = "res" + Number.ToString(); rc.BaseColor = GetCalendarColor(Number); rc.Name = item.fullName; rc.Description = item.fullName; rc.IsVisible = true; _rcCollection.Add(rc); return _rcCollection; }
But i did not found any option to Show/Side Calander CaptionHeaderText and to set text, as we have myDayView.CaptionHeaderText = "Heading"; in our web control.
You can look at the feature browser for examples of that type of display. That screenshot shows a scenario where the CalendarGroups collection of the xamScheduleDataManager (or the CalendarGroupsOverride of a specific xamDayView instance) has 2 CalendarGroup instances where the Calendars collection of each contains 2 ResourceCalendars (usually initialized by setting the InitializeCalendarIds of the CalendarGroup). Each ResourceCalendar is represented as a tab item. CalendarGroups are discussed in the help here.
The caption of that tab item (the element is CalendarHeader) that is displayed contains a combination of the Resource's Name and/or the ResourceCalendar's Name. In 10.3, it only contains the ResourceCalendar's Name but in 11.1, the default header is similar to that of Outlook where it will contain the ResourceName if the calendar's OwningResource is the CurrentUser of the xamScheduleDataManager, the Name of the OwningResource if the calendar is the DefaultCalendar of its OwningResource, and otherwise is a concatenation of the OwningResource's Name and the calendar's Name. So essentially the caption that is displayed comes from the Name property of the Resource/ResourceCalendar that you are providing - i.e. from your data.
Thanks Andrew,
above information is very helpful for me.
Please help me! Is there any way to not display the day in viewday as picture below:
This isn't really related to the original question posed in this forum thread so it would be best to start a different one next time.
The easiest way to help find an answer to questions such as this is to get Snoop and look at the element tree to see where those elements are. In this case there are several ScheduleDateTimePresenter instances that are providing those visuals. These exist within the DayViewDayHeader element so if you do not want those in there then you would retemplate the DayViewDayHeader and remove or collapse those elements.
The best place to start with creating custom templates is to take a copy of the existing one from the DefaultStyles directory (e.g. C:\Program Files\Infragistics\NetAdvantage 2011.1\WPF\DefaultStyles). In this case that template looks like the following:
<Style TargetType="igSchedulePrim:DayViewDayHeader"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="igSchedulePrim:DayViewDayHeader"> <Border BorderBrush="{TemplateBinding ComputedBorderBrush}" BorderThickness="{TemplateBinding ComputedBorderThickness}" Background="{TemplateBinding ComputedBackground}" Padding="{TemplateBinding Padding}" igPrim:XamlHelper.SnapsToDevicePixels="True"> <Grid igPrim:XamlHelper.SnapsToDevicePixels="{TemplateBinding igPrim:XamlHelper.SnapsToDevicePixels}" > <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <igSchedulePrim:ScheduleDateTimePresenter HorizontalAlignment="Left" FormatType="DayOfMonthNumber" DateTime="{Binding DateTime, RelativeSource={RelativeSource TemplatedParent}}" FontWeight="Bold" Foreground="{TemplateBinding ComputedForeground}"/> <igPrim:BestFitPanel x:Name="FullDayName" Grid.Column="1" HorizontalAlignment="Center" Margin="0,0,7,0"> <igSchedulePrim:ScheduleDateTimePresenter FormatType="DayOfWeek" DateTime="{Binding DateTime, RelativeSource={RelativeSource TemplatedParent}}" Foreground="{TemplateBinding ComputedForeground}"/> <igSchedulePrim:ScheduleDateTimePresenter FormatType="ShortDayOfWeek" DateTime="{Binding DateTime, RelativeSource={RelativeSource TemplatedParent}}" Foreground="{TemplateBinding ComputedForeground}"/> <igSchedulePrim:ScheduleDateTimePresenter FormatType="ShortestDayOfWeek" DateTime="{Binding DateTime, RelativeSource={RelativeSource TemplatedParent}}" Foreground="{TemplateBinding ComputedForeground}"/> </igPrim:BestFitPanel> </Grid> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style>
And that requires some namespace mappings (also taken from the same xaml file where the template was taken):
xmlns:ig="http://schemas.infragistics.com/xaml" xmlns:igPrim="http://schemas.infragistics.com/xaml/primitives" xmlns:igSchedulePrim="http://schemas.infragistics.com/xaml/primitives"
So you could remove the Grid within the Border. Note since there would be no content to provide any height you may want to add a setter for the MinHeight or put something (like a textblock) within the template in place of the grid.
Im sorry for inconvenience. Thanks for the support.
There isn't a property since that is something that might be different per locale and instead is something that is defined by resource strings. You can see a list of the schedule related resource strings here. This other help topic discusses how one overrides/defines custom resource strings. In the case of xamSchedule the RegisterResources method is defined on the ScheduleControlBase class.
Is there a setting to just show the calendar name and not the full resource name-calendar name concatenation?
Thanks,
David