This is a migrated thread and some comments may be shown as answers.

how to use bingding property in the ScheduleView ConrolTemplate

1 Answer 43 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Yi
Top achievements
Rank 1
Yi asked on 01 Nov 2013, 08:47 AM
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.

1 Answer, 1 is accepted

Sort by
0
Accepted
Kalin
Telerik team
answered on 05 Nov 2013, 03:50 PM
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 >>
Tags
ScheduleView
Asked by
Yi
Top achievements
Rank 1
Answers by
Kalin
Telerik team
Share this question
or