Hi,
using the xamDayView, I would like to see, besides the subject, also the description of the appointment. I guess I have to customize the AppointmentPresenter.Style but I couldn't find any sample nor in the feature browser, nor in the online help.Can someone please guide me ?
Best RegardsRoberto Dalmonte
Hi Roberto,
As all our controls you can get the templates for them from DefaultStyles folder where the product is installed i.e. “C:\Program Files\Infragistics\NetAdvantage 2010.3\WPF\DefaultStyles\Schedule”. For AppointmentPresenter and ActivityPresenter you can find them in generic.shared.xaml file. Hope this helps.
Thanks,
Diyan Dimitrov
As you suggested I tried modifying the template. Particularly I modified the activityToolTipTemplate adding a TextBlock with a fake message, saved the modified template. I hoped to see my custom tooltip without success.
<DataTemplate x:Key="activityToolTipTemplate">
<StackPanel Orientation="Vertical" Margin="5,0,3,0">
<StackPanel Orientation="Horizontal">
<igSchedulePrim:ScheduleDateRangePresenter
ConvertDateTimeToLocal="{Binding Path=Activity.IsTimeZoneNeutral, Converter={StaticResource notConverter}}"
FontSize="{Binding Path=ActivityPresenter.FontSize}"
Start="{Binding Path=Activity.Start}"
End="{Binding Path=Activity.End}"
/>
<TextBlock Text="{Binding Path=Activity.Subject}"
Margin="5,0,0,0"
<TextBlock Text="Hello from me"
</StackPanel>
What did I do wrong? My goal is to be able to show something else beyond the Subject (i.e. description) or some graphic symbols before or after the Subject. Can you provide a sample?Roberto
You should copy all necessary templates and resources from generic.shared.xaml to your application. I am attaching a sample project.
Hi Diyan, it's me again.Being able to assing a color to an appointment is a major necessity and, in fact, it is an important feature in your own schedule compontes for winforms.I guess that a bindable ActivityColor property in the Activity Class would do it. Having that property would allow the user to re-template this way the control templates contained in the file generic.shared.xaml
<ControlTemplate x:Key="ActivityTemplate" TargetType="igSchedulePrim:ActivityPresenter">
<Border BorderThickness="3" BorderBrush="{Binding ActivityColor}">
<Grid>
[...]
</Grid>
</Border>
</ControlTemplate>In your code then, you might be able to do something like:
foreach (var item in apps) { Appointment app = new Appointment() {
ActivityColor = GetMyCustomColor(), Subject = String.Format("{0} ({1})", item.ContactHelper, item.Chair), Description = item.Description, Start = new DateTime(item.StartDate), End = new DateTime(item.EndDate) }; appointments.Add(app); }
Best Regards
Thank you so much.
Roberto
robdal said: Let me rephrase my question then: since my goal is to custom-color the border of each appointment do you have some sample code on how can I obtain such a goal?
Let me rephrase my question then: since my goal is to custom-color the border of each appointment do you have some sample code on how can I obtain such a goal?
So you would change that such that you either access a property directly on the DataItem of the Activity or use the MetadataPropertyMapping. That primarily depends on whether you want to be able to get/set this from within a new activity since the dataitem won't exist for a new activity until it is committed. Assuming you just want to access a System.Windows.Media.Color property on the DataItem then that path would look something like:
<Path x:Name="BorderPath" Fill="{TemplateBinding ComputedBackground}" StrokeThickness ="{TemplateBinding ComputedBorderStrokeThickness}" igPrim:XamlHelper.SnapsToDevicePixels="True"> <Path.Stroke> <SolidColorBrush Color="{Binding DataItem.BorderColor}" /> </Path.Stroke> </Path>
Or maybe if you know what you will default the bordercolor will be for your data items and you are allowing in place creation of activities you might provide a FallbackValue:
<Path x:Name="BorderPath" Fill="{TemplateBinding ComputedBackground}" StrokeThickness ="{TemplateBinding ComputedBorderStrokeThickness}" igPrim:XamlHelper.SnapsToDevicePixels="True"> <Path.Stroke> <SolidColorBrush> <SolidColorBrush.Color> <Binding Path="DataItem.BorderColor"> <Binding.FallbackValue> <Color>Purple</Color> </Binding.FallbackValue> </Binding> </SolidColorBrush.Color> </SolidColorBrush> </Path.Stroke> </Path>
If you were using the MetadataPropertyMappings then the path would probably look something like:
<Path x:Name="BorderPath" Fill="{TemplateBinding ComputedBackground}" StrokeThickness ="{TemplateBinding ComputedBorderStrokeThickness}" igPrim:XamlHelper.SnapsToDevicePixels="True"> <Path.Stroke> <SolidColorBrush Color="{Binding Metadata[BorderColor]}" /> </Path.Stroke> </Path>
No such a property was not added as part of 11.1. In 11.1 we did add ActivityCategory support and when an activity is associated with one or more ActivityCategory's (via its Categories property) it's Background/Foreground/Border are calculated based upon the Color property of the 1st ActivityCategory.
Hello Petar,I was wondering if in version 11.1 there is a ActivityColor bindable property.
I wasn't able to find one, but it may come under another name or maybe you can obtain the same result following another procedure (I was not able to find that either)
Roberto Dalmonte