Custom TimeMarkers - no text appears

9 posts, 0 answers
  1. Oksana
    Oksana avatar
    23 posts
    Member since:
    Mar 2009

    Posted 01 Mar 2011 Link to this post

    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

  2. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 02 Mar 2011 Link to this post

    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!
  3. UI for WPF is Visual Studio 2017 Ready
  4. Oksana
    Oksana avatar
    23 posts
    Member since:
    Mar 2009

    Posted 03 Mar 2011 Link to this post

    Hello Valeri,

    Named parameters worked fine.

    Thank you,

    Oksana

  5. Carlos Mattos
    Carlos Mattos avatar
    5 posts
    Member since:
    Mar 2010

    Posted 19 Apr 2012 Link to this post

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

     

  6. Carlos Mattos
    Carlos Mattos avatar
    5 posts
    Member since:
    Mar 2010

    Posted 19 Apr 2012 Link to this post

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

     

  7. Rieni De Rijke
    Rieni De Rijke avatar
    170 posts
    Member since:
    Mar 2010

    Posted 23 Jul 2013 Link to this post

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




  8. Kalin
    Admin
    Kalin avatar
    1208 posts

    Posted 24 Jul 2013 Link to this post

    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 >>
  9. Rieni De Rijke
    Rieni De Rijke avatar
    170 posts
    Member since:
    Mar 2010

    Posted 25 Jul 2013 Link to this post

    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...
  10. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 29 Jul 2013 Link to this post

    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 >>
Back to Top
UI for WPF is Visual Studio 2017 Ready