The MindFusion Forums
Scheduling and Gantt Components >> WPF >> TimetableSettings Bindings
https://mindfusion.eu/Forum/YaBB.pl?num=1539250949

Message started by Nika on Oct 11th, 2018 at 9:42am

Title: TimetableSettings Bindings
Post by Nika on Oct 11th, 2018 at 9:42am
Hello Meppy,

I'd like to bind the Dates Property to a DateCollection, which is in another class.

This is my XAML Code so far:
<planner:Calendar Theme="{Binding Path=Theme}">
   <planner:Calendar.TimetableSettings>
      <planner:TimetableSettings Dates="{Binding
          Path=DateCollection}"> ...

Now you see that I already did that with the Theme Property of the Calendar and it works perfectly. But it won't work with Dates, although I did the Binding exactly like the Theme Binding.
I tried to debug it and it doesn't even go inside get{...}.

I saw some answers how to deal with that problem in the code-behind, but I have to work strictly with the MVVM pattern.

Thanks in advance  :)

Title: Re: TimetableSettings Bindings
Post by Slavcho on Oct 11th, 2018 at 4:44pm
Hi,

Binding worked in my test project -
https://mindfusion.eu/_samples/DatesBinding.zip

Check if your DateCollection is a public property and of same MindFusion.Scheduling.Wpf.DateCollection type as TimetableSettings' one.

Regards,
Slavcho
Mindfusion

Title: Re: TimetableSettings Bindings
Post by Nika on Oct 15th, 2018 at 7:35am
Thanks for your response, but sadly it didn't help. As I already said, I did everyting just like with the Theme and there everyting worked perfectly.

I tried to debug the DataBinding with the System.Diagnostics class and this is what I get:

System.Windows.Data Warning: 56 : Created BindingExpression (hash=53954942) for Binding (hash=11903911)
System.Windows.Data Warning: 58 :   Path: 'DateCollection'
System.Windows.Data Warning: 60 : BindingExpression (hash=53954942): Default mode resolved to OneWay
System.Windows.Data Warning: 61 : BindingExpression (hash=53954942): Default update trigger resolved to PropertyChanged
System.Windows.Data Warning: 62 : BindingExpression (hash=53954942): Attach to MindFusion.Scheduling.Wpf.TimetableSettings.Dates (hash=52136226)
System.Windows.Data Warning: 67 : BindingExpression (hash=53954942): Resolving source
System.Windows.Data Warning: 70 : BindingExpression (hash=53954942): Found data context element: TimetableSettings (hash=52136226) (OK)
System.Windows.Data Warning: 71 : BindingExpression (hash=53954942): DataContext is null
System.Windows.Data Warning: 65 : BindingExpression (hash=53954942): Resolve source deferred
System.Windows.Data Warning: 67 : BindingExpression (hash=53954942): Resolving source
System.Windows.Data Warning: 70 : BindingExpression (hash=53954942): Found data context element: TimetableSettings (hash=52136226) (OK)
System.Windows.Data Warning: 71 : BindingExpression (hash=53954942): DataContext is null

With the working Binding it looks like this:

System.Windows.Data Warning: 56 : Created BindingExpression (hash=3957675) for Binding (hash=29135240)
System.Windows.Data Warning: 58 :   Path: 'Theme'
System.Windows.Data Warning: 60 : BindingExpression (hash=3957675): Default mode resolved to OneWay
System.Windows.Data Warning: 61 : BindingExpression (hash=3957675): Default update trigger resolved to PropertyChanged
System.Windows.Data Warning: 62 : BindingExpression (hash=3957675): Attach to MindFusion.Scheduling.Wpf.Calendar.Theme (hash=12674872)
System.Windows.Data Warning: 67 : BindingExpression (hash=3957675): Resolving source
System.Windows.Data Warning: 70 : BindingExpression (hash=3957675): Found data context element: Calendar (hash=12674872) (OK)
System.Windows.Data Warning: 71 : BindingExpression (hash=3957675): DataContext is null
System.Windows.Data Warning: 65 : BindingExpression (hash=3957675): Resolve source deferred
System.Windows.Data Warning: 67 : BindingExpression (hash=3957675): Resolving source
System.Windows.Data Warning: 70 : BindingExpression (hash=3957675): Found data context element: Calendar (hash=12674872) (OK)
System.Windows.Data Warning: 78 : BindingExpression (hash=3957675): Activate with root item MainWindowVM (hash=31874772)
System.Windows.Data Warning: 108 : BindingExpression (hash=3957675):   At level 0 - for MainWindowVM.Theme found accessor RuntimePropertyInfo(Theme)
System.Windows.Data Warning: 104 : BindingExpression (hash=3957675): Replace item at level 0 with MainWindowVM (hash=31874772), using accessor RuntimePropertyInfo(Theme)
System.Windows.Data Warning: 101 : BindingExpression (hash=3957675): GetValue at level 0 from MainWindowVM (hash=31874772) using RuntimePropertyInfo(Theme): 'Windows2003'
System.Windows.Data Warning: 80 : BindingExpression (hash=3957675): TransferValue - got raw value 'Windows2003'
System.Windows.Data Warning: 89 : BindingExpression (hash=3957675): TransferValue - using final value 'Windows2003'

I can't find any solution online  :(

Title: Re: TimetableSettings Bindings
Post by Slavcho on Oct 15th, 2018 at 8:15am
Please attach a test project reproducing that - e.g. modify mine above to show your setup, and our developer will investigate.

Title: Re: TimetableSettings Bindings
Post by Nika on Oct 15th, 2018 at 9:35am
Here's the small version of the solution.
Thanks for your help. :)

https://mindfusion.eu/Forum/YaBB.pl?action=downloadfile;file=Stundenverwaltung.zip ( 11 KB | 256 Downloads )

Title: Re: TimetableSettings Bindings
Post by Slavcho on Oct 16th, 2018 at 8:12am
Below is wham I'm getting, is it the expected result? If yours is different, maybe you have older version of the control than one I'm testing with. Try replacing your assemblies with the one from my test project above.



Regards,
Slavcho

Title: Re: TimetableSettings Bindings
Post by Nika on Oct 16th, 2018 at 8:44am
It works now with your assemblies. Thank you very much!  :) ;D

The MindFusion Forums » Powered by YaBB 2.6.11!
YaBB Forum Software © 2000-2024. All Rights Reserved.