This is a migrated thread and some comments may be shown as answers.
Custom TimeMarkers - no text appears
8 Answers 89 Views
This is a migrated thread and some comments may be shown as answers.
Oksana
Top achievements
Rank 1
Oksana asked on 01 Mar 2011, 11:05 PM

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

Sort by
0
Valeri Hristov
Telerik team
answered on 02 Mar 2011, 05:37 PM
Hello Oksana,

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
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Oksana
Top achievements
Rank 1
answered on 03 Mar 2011, 05:08 PM

Hello Valeri,

Named parameters worked fine.

Thank you,

Oksana

0
Carlos Mattos
Top achievements
Rank 2
answered on 19 Apr 2012, 09:17 PM
I'm using Telerik WPF Q1 2012 and have exactly the same problem. I'm using a custom LocalizationManager to translate all strings to Portuguese-Brazil. I solve the problem including the new TimeMarkers (i.e. Em Consulta, Com Representante, etc) in my LocalizationManager, only then the text appears in my custom edit appointment dialog.

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);

 

0
Carlos Mattos
Top achievements
Rank 2
answered on 19 Apr 2012, 09:18 PM
I'm using Telerik WPF Q1 2012 and have exactly the same problem. I'm using a custom LocalizationManager to translate all strings to Portuguese-Brazil. I solve the problem including the new TimeMarkers (i.e. Em Consulta, Com Representante, etc) in my LocalizationManager, only then the text appears in my custom edit appointment dialog.

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);

 

0
Rieni De Rijke
Top achievements
Rank 1
answered on 23 Jul 2013, 01:07 PM
Has this problem been fixed?

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...




0
Kalin
Telerik team
answered on 24 Jul 2013, 01:35 PM
Hello Rieni,

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
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
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 >>
0
Rieni De Rijke
Top achievements
Rank 1
answered on 25 Jul 2013, 07:28 AM
Thank you for your quick response.
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...
0
Yana
Telerik team
answered on 29 Jul 2013, 12:14 PM
Hi Rieni,

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
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
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 >>
Asked by
Oksana
Top achievements
Rank 1
Answers by
Valeri Hristov
Telerik team
Oksana
Top achievements
Rank 1
Carlos Mattos
Top achievements
Rank 2
Rieni De Rijke
Top achievements
Rank 1
Kalin
Telerik team
Yana
Telerik team
Share this question
or