With x:Bind you have to do the following
- set your ThemeViewModel as Page.DataContext and bind Color to _viewModel.PrimaryColor <Page.DataContext>
<themeViewModels:ThemeViewModel/>
</Page.DataContext>
<Grid Grid.Column="1">
<Grid.Background>
<SolidColorBrush x:Name="ss" Color="{x:Bind _viewModel.PrimaryColor, Mode=OneWay}"/>
</Grid.Background>
</Grid> - declare field _viewModel in your Page code behind private ThemeViewModel _viewModel;
- use DataContextChanged event: add this code in your page constructor DataContextChanged += (sender, args) =>
{
if (_viewModel == args.NewValue || !(args.NewValue is ThemeViewModel themeViewModel)) return;
_viewModel = themeViewModel;
Bindings.Update();
};