how to use bingding property in the ScheduleView ConrolTemplate

2 posts, 1 answers
  1. Yi
    Yi avatar
    15 posts
    Member since:
    Jul 2013

    Posted 01 Nov 2013 Link to this post

    i add the SchuleView Theme to my project.
    and the controlTemple Binding like:
    <telerik:RadComboBox x:Name="PART_TimeMarkers"
                                             Margin="2 1"
                                             Width="110"
                                             IsEnabled="{Binding IsReadOnly, Converter={StaticResource InvertedBooleanConverter}}"
                                             ClearSelectionButtonVisibility="Visible"
                                             ClearSelectionButtonContent="Clear All"
                                             EmptyText="TimeMarkers
    "
                                             ItemsSource="{Binding TimeMarkers}"
                                             SelectedItem="{Binding Occurrence.Appointment.TimeMarker, Mode=TwoWay}"
                                             ItemTemplate="{StaticResource TimeMarkerComboBoxItemContentTemplate}"
                                             SelectionBoxTemplate="{StaticResource TimeMarkerComboBoxItemContentTemplate}"
                                             telerik:StyleManager.Theme="{StaticResource Theme}"/>
    for example: i follow the demo project,and binding the ItemsSource successfully. but how can i make the RadComboBox has default value? set the SelectedIndex seems to not use. and how to binding IsEnabled property.which palace i can set the value. and how to ClearSelectionButtonContent Property to localization? 
    sorry that i am a fresher.
    thank you.



    Posted 1 day ago (permalink)

    i add the SchuleView Theme to my project.
    and the controlTemple Binding like:
    <telerik:RadComboBox x:Name="PART_TimeMarkers"
                                             Margin="2 1"
                                             Width="110"
                                             IsEnabled="{Binding IsReadOnly, Converter={StaticResource InvertedBooleanConverter}}"
                                             ClearSelectionButtonVisibility="Visible"
                                             ClearSelectionButtonContent="Clear All"
                                             EmptyText="TimeMarkers
    "
                                             ItemsSource="{Binding TimeMarkers}"
                                             SelectedItem="{Binding Occurrence.Appointment.TimeMarker, Mode=TwoWay}"
                                             ItemTemplate="{StaticResource TimeMarkerComboBoxItemContentTemplate}"
                                             SelectionBoxTemplate="{StaticResource TimeMarkerComboBoxItemContentTemplate}"
                                             telerik:StyleManager.Theme="{StaticResource Theme}"/>
    for example: i follow the demo project,and binding the ItemsSource successfully. but how can i make the RadComboBox has default value? set the SelectedIndex seems to not use. and how to binding IsEnabled property.which palace i can set the value. and how to ClearSelectionButtonContent Property to localization? 
    sorry that i am a fresher.
    thank you.

    Posted 1 day ago (permalink)

    i add the SchuleView Theme to my project.
    and the controlTemple Binding like:
    <telerik:RadComboBox x:Name="PART_TimeMarkers"
                                             Margin="2 1"
                                             Width="110"
                                             IsEnabled="{Binding IsReadOnly, Converter={StaticResource InvertedBooleanConverter}}"
                                             ClearSelectionButtonVisibility="Visible"
                                             ClearSelectionButtonContent="Clear All"
                                             EmptyText="TimeMarkers
    "
                                             ItemsSource="{Binding TimeMarkers}"
                                             SelectedItem="{Binding Occurrence.Appointment.TimeMarker, Mode=TwoWay}"
                                             ItemTemplate="{StaticResource TimeMarkerComboBoxItemContentTemplate}"
                                             SelectionBoxTemplate="{StaticResource TimeMarkerComboBoxItemContentTemplate}"
                                             telerik:StyleManager.Theme="{StaticResource Theme}"/>
    for example: i follow the demo project,and binding the ItemsSource successfully. but how can i make the RadComboBox has default value? set the SelectedIndex seems to not use. and how to binding IsEnabled property.which palace i can set the value. and how to ClearSelectionButtonContent Property to localization? 
    sorry that i am a fresher.
    thank you.
  2. Answer
    Kalin
    Admin
    Kalin avatar
    1208 posts

    Posted 05 Nov 2013 Link to this post

    Hello Yi,

    Straight to your questions - in order to have a default TimeMarker selected when the EditAppointmentDialog is open you could use the ShowDialog event. Inside of the handler you can reach the AppointmentDialogViewModel with the TimeMarker collection and set one of them as default to the new Appointment.

    The IsReadOnly property is used in many places in the EditAppointmentDialog, that's why changing its value will disable the whole EditAppointmentDialog. However you could use the AdditionalData property which is used only for adding a custom logic and then also in the ShowDialog event handler you can change it true or false depending of the requirement.

    As for the last question the ClearSelectionButtonContent is localized by default, so you don't need to do anything extra just keep the default binding.

    IsEnabled and ClearSelectionButtonContent should look like follows:
    IsEnabled="{Binding AdditionalData, Converter={StaticResource InvertedBooleanConverter}}"
    ClearSelectionButtonContent="{Binding ClearSelectionButtonContent}"

    The ShowDialog event handler should look like below:
    private void scheduleView_ShowDialog(object sender, ShowDialogEventArgs e)
    {
        if (e.DialogViewModel is AppointmentDialogViewModel)
        {
            var dialogVM = e.DialogViewModel as AppointmentDialogViewModel;
            var appointment = dialogVM.Occurrence.Appointment as Appointment;
            if (appointment != null)
            {
                appointment.TimeMarker = dialogVM.TimeMarkers.First();
                dialogVM.AdditionalData = true;
            }               
        }
    }

    Hope this works for you.

    Regards,
    Kalin
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    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 >>
  3. DevCraft banner
Back to Top