leonid_golovko
Topic Author
Posts: 13
Joined: 13 Jun 2024, 15:06

Binding from a few view models

08 Jul 2024, 14:22

I have two view models and the second one is not seen by the system.
How to make the xaml see this second view model?
The second view model called CircleViewModel.
Thank you for the answer in advance!

<Image Source="{StaticResource CenterCircleButtonOff}" Stretch="Uniform" Visibility="{Binding CircleCenterOffMouseVisibility, Converter={StaticResource BooleanToVisibilityConverter}}"/>

[NOESIS/E] Binding failed: Path=CircleCenterOffMouseVisibility, Source=DataModelApp.ViewModel(''), Target=Image(''), TargetProperty=UIElement.Visibility
 
User avatar
sfernandez
Site Admin
Posts: 3112
Joined: 22 Dec 2011, 19:20

Re: Binding from a few view models

08 Jul 2024, 18:30

If you manually set the Visibility of the Image to "Visible", does it show as expected?
In that case, are you sure that the viewmodel is available to that Image? If you bind the property CircleCenterOffMouseVisibility to a TextBlock.Text for example, does it show the correct value?
 
leonid_golovko
Topic Author
Posts: 13
Joined: 13 Jun 2024, 15:06

Re: Binding from a few view models

09 Jul 2024, 07:18

I just wanted to print the same class 4 times in a diagonal and it print four circles but not in the right coordinates.
It did not change no matter what I did.
 
User avatar
sfernandez
Site Admin
Posts: 3112
Joined: 22 Dec 2011, 19:20

Re: Binding from a few view models

09 Jul 2024, 12:57

Could this be related to your other post: viewtopic.php?p=17268#p17268
As I pointed out there, each item in an ItemsControl is wrapped by a ContentPresenter, so canvas position must be set in that element, not in the root of the ItemTemplate.
 
leonid_golovko
Topic Author
Posts: 13
Joined: 13 Jun 2024, 15:06

Re: Binding from a few view models

11 Jul 2024, 11:33

Yes. Now this problem was solved! Thank you!

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 1 guest