Hello,
this is the picture:
I have a solution with SILVERLIGHT/WPF shared code and, whenever possible, I use shared UserControls in the 2 projects.
I use my own custom dialogs (AppointmentDialogFactory : ScheduleDialogFactoryBase) in order to show a customize window to the user inserting a new appointment or updating an existing one.
Since I want to use shared code my custom dialogs are UserControls.
Now, while I managed to do everything I wanted to, I am missing 2 things:
1) I don't know how to set width and height of the hosting window (yours) , since your window does not take in account the usercontrol dimensions (which I set to my needs).
2) When I'm done with the new appointment how to I close your window?
I guess it's something silly, but ... I'm lost.
Best Regards
Roberto
Hi Roberto,
Let me know if you have any further questions.
Binding it that way doesn't seem to work for me either. I thought indirect property targeting might work but I guess not.
To avoid the dialogs, the XamScheduleDataManager has some events for you to hook into. The event your interested in is ActivityDialogDisplaying. This event is fired when an appointment dialog is opened so inside this event you can cancel it and display your own dialog if you wish.
Hello Rob,I tried what you suggested ... without luck.
This is my dialogue in case the Appointment is new:
public class AppointmentDialogCoreNew : AppointmentDialogCore { /// <summary> /// /// </summary> /// <param name="container"></param> /// <param name="dataManager"></param> /// <param name="appointment"></param> public AppointmentDialogCoreNew(FrameworkElement container, XamScheduleDataManager dataManager, Appointment appointment) : base(container, dataManager, appointment) { newAppointmentViewModel = new NewAppointmentViewModel(dataManager, appointment); } /// <summary> /// /// </summary> private NewAppointmentViewModel newAppointmentViewModel; /// <summary> /// /// </summary> public NewAppointmentViewModel NewAppointmentViewModel { get { return newAppointmentViewModel; } set { newAppointmentViewModel = value; } }
}
If I debug I can see that the NewAppointmentViewModel is regularly instantiated and my custom properties filled with their values.
As for the template I changed all of the bindings from Value="{Binding Path=TimeUnit, Mode=TwoWay}"toValue="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=NewAppointmentViewModel.TimeUnit, Mode=TwoWay}"
Nonetheless my bindings are not working.
My ideal situation would be to AVOID AT ALL the dialogs, either yours and mine: when I double click I would like to navigate to a page of my choice. Is it possible to suppress the creation of the dialog window altogether? This way I would have solved my problems.
I believe the CustomAppointmentDialogCore should be treated more like a view since this class is actually a Control. You should probably have a seperate view model class that you instantiate inside CustomAppointmentDialogCore and bind to it through XAML by modifying the binding paths. For example, your binding paths would change to this:
"{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ViewModel.AutoCompleteItems, Mode=TwoWay}"
Hi Rob,given the sample you provide, which class should be the ViewModel for the bindings? The CustomAppointmentDialogCore?