Hi,
I’m binding CategotiesSource to my Categories collection and TimeMarkersSource to my TimeMarkers collection.
While categories are displaying perfectly right in the Edit Dialog, TimeMarkers drop down displays only Brushes’ colors I have defined; no text appears next to them.
What can be wrong?
thank you
8 Answers, 1 is accepted
When you create the custom time markers, do you use the two-parameter constructor of the TimeMarker class?
var timeMarker = new TimeMarker("My Marker", brush);
If this is similar to your code, please, try with:
var timeMarker = new TimeMarker { TimeMarkerName = "My Marker", TimeMarkerBrush = brush };
When you use the two-parameter constructor we internally try to get a localized string with key "My Marker" and since there is no such string, the time marker has no name. If you set the property explicitly as in my second snippet, the timer marker will receive the proper name.
We will fix this problem with the official Q1 2011 release, which is due in two weeks.
Regards,
Valeri Hristov
the Telerik team

Hello Valeri,
Named parameters worked fine.
Thank you,
Oksana

I'm persisting ScheduleView in Access Database using a custom provider, in this code fragment, to load TimeMarkers, I'm reading data from DataReader (dr), I had tried three different ways (below), but only works after I insert my custom strings in my custom Localization Manager. Is there any fix to this?
TimeMarker timeMarkerToAdd = new TimeMarker();
timeMarkerToAdd.TimeMarkerName = dr[
"TimeMarkerName"].ToString();
timeMarkerToAdd.TimeMarkerBrush = brushConverter.ConvertFromString(dr[
"TimeMarkerBrushName"].ToString()) as SolidColorBrush;
var timeMarkerToAdd = new TimeMarker { TimeMarkerName = dr["TimeMarkerName"].ToString(), TimeMarkerBrush = brushConverter.ConvertFromString(dr["TimeMarkerBrushName"].ToString()) as SolidColorBrush };
var timeMarkerToAdd = new TimeMarker(dr["TimeMarkerDisplayName"].ToString(), brushConverter.ConvertFromString(dr["TimeMarkerBrushName"].ToString()) as SolidColorBrush);

I'm persisting ScheduleView in Access Database using a custom provider, in this code fragment, to load TimeMarkers, I'm reading data from DataReader (dr), I had tried three different ways (below), but only works after I insert my custom strings in my custom Localization Manager. Is there any fix to this?
TimeMarker timeMarkerToAdd = new TimeMarker();
timeMarkerToAdd.TimeMarkerName = dr["TimeMarkerName"].ToString();
timeMarkerToAdd.TimeMarkerBrush = brushConverter.ConvertFromString(dr["TimeMarkerBrushName"].ToString()) as SolidColorBrush;
var timeMarkerToAdd = new TimeMarker { TimeMarkerName = dr["TimeMarkerName"].ToString(), TimeMarkerBrush = brushConverter.ConvertFromString(dr["TimeMarkerBrushName"].ToString()) as SolidColorBrush };
var timeMarkerToAdd = new TimeMarker(dr["TimeMarkerDisplayName"].ToString(), brushConverter.ConvertFromString(dr["TimeMarkerBrushName"].ToString()) as SolidColorBrush);

I use Telerik v. 2013.2.611.40
I tried to set my own TimeMarkers in XAML.
<telerik:RadScheduleView.TimeMarkersSource>
<telerik:TimeMarkerCollection>
<telerik:TimeMarker TimeMarkerName="Zwapp" TimeMarkerBrush="Red" />
<telerik:TimeMarker TimeMarkerName="Boff" TimeMarkerBrush="Green" />
</telerik:TimeMarkerCollection>
</telerik:RadScheduleView.TimeMarkersSource>
I also tried to add them like this:
MyTimeMarkers = new ObservableCollection<TimeMarker>();
var timeMarker = new TimeMarker { TimeMarkerName = "Out", TimeMarkerBrush = new SolidColorBrush(Colors.Blue};
MyTimeMarkers.Add(timeMarker);
timeMarker = new TimeMarker { TimeMarkerName = "In", TimeMarkerBrush = new SolidColorBrush(Colors.Yellow};
MyTimeMarkers.Add(timeMarker);
MyScheduleView.TimeMarkersSource = MyTimeMarkers;
The text never shows up in the Appointment-Dialog...
We tested the provided XAML code and the TimeMarkers text appeared as expected. I've attached a sample project and the video of our test, can you please see them and let us know if we are missing something here?
I'm looking forward to your reply.
Regards,
Kalin
Telerik
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>

It has to do with Localization.
The text for the TimeMarkers will not show when I add this:
public MainWindow()
{
LocalizationManager.DefaultCulture = new CultureInfo("no");
LocalizationManager.Manager = new CustomLocalizationManager();
ObservableAppointmentCollection appointments = new ObservableAppointmentCollection();
InitializeComponent();
this.scheduleView.AppointmentsSource = appointments;
}
It shows when I add the words in my CustomLocalizationManager-file:
Like this: case "Boff": return "Boff";
You can also change the final line in the CustomLocalizationManager:
// return base.GetStringOverride(key);
return key;
But this is not to prefer I think.
And what to do when you want to add TimeMarkers dynamicly...
Please excuse us for the misunderstanding.
Indeed, the TimeMarkers are localized and that's the reason the text is not shown in the described scenario. As you prefer not to add localization strings for them, you should edit the EditAppointmentDialog template, more specifically the DataTemplate with Key="TimeMarkerComboBoxItemContentTemplate" and change the binding of the TextBlock like this:
<
DataTemplate
x:Key
=
"TimeMarkerComboBoxItemContentTemplate"
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
Rectangle
Fill
=
"{Binding TimeMarkerBrush}"
Margin
=
"2 0"
Width
=
"12"
Height
=
"12"
/>
<
TextBlock
Text
=
"{Binding TimeMarkerName}"
Margin
=
"2 0"
/>
</
StackPanel
>
</
DataTemplate
>
I have attached a sample project which demonstrates the exact approach, please note that I've used Implicit Styles in order to make the customization easily.
I hope this helps.
Regards,
Yana
Telerik
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>