Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x:Bind with a converter not applicable for a Window XAML via C++/WinRT #8481

Open
ACGNnsj opened this issue May 14, 2023 · 0 comments
Open
Labels
area-Binding bug Something isn't working team-Markup Issue for the Markup team

Comments

@ACGNnsj
Copy link

ACGNnsj commented May 14, 2023

Describe the bug

template <typename D, typename... I>
    IComponentConnector FormalOverlayT<D, I...>::GetBindingConnector(int32_t connectionId, IInspectable const& target)
    {
        ::winrt::com_ptr<::winrt::OCR::implementation::XamlBindings> bindings;
        switch (connectionId)
        {
            case 1: // FormalOverlay.xaml line 4
                {
                    auto element1 = target.as<::winrt::Microsoft::UI::Xaml::Window>();
                    auto objBindings = std::make_unique<FormalOverlay_obj1_Bindings>();
                    objBindings->SetDataRoot(*this);
                    objBindings->SetConverterLookupRoot(*this);
                    bindings = ::winrt::make_self<::winrt::OCR::implementation::XamlBindings>(std::move(objBindings));
                    Bindings = bindings;
                    element1.Activated({&*bindings, &::winrt::OCR::implementation::XamlBindings::Activated});
                }
                break;
        }
        return bindings ? bindings.as<::winrt::Microsoft::UI::Xaml::Markup::IComponentConnector>() : nullptr;
    }
void SetConverterLookupRoot(::winrt::Microsoft::UI::Xaml::FrameworkElement const& rootElement)
        {
            converterLookupRoot = rootElement;
        }

In the generated files, the root element of a XAML is arbitrarily assumed to be a FrameworkElement, which would definitely cause promblems in some cases.
Just like that in this report. #4966
I would like to know if there is a plan for solving this.

Steps to reproduce the bug

Here is my demo project.
FormalOverlay.xaml DoubleToThicknessConverter.idl DoubleToThicknessConverter.h

Expected behavior

No response

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.3.1: 1.3.230502000

Windows version

Windows Insider Build (xxxxx)

Additional context

No response

@ACGNnsj ACGNnsj added the bug Something isn't working label May 14, 2023
@ACGNnsj ACGNnsj changed the title x:Bind not applicable for a Window XAML via C++/WinRT x:Bind with a converter not applicable for a Window XAML via C++/WinRT May 14, 2023
@bpulliam bpulliam added team-Markup Issue for the Markup team area-Binding labels Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Binding bug Something isn't working team-Markup Issue for the Markup team
Projects
None yet
Development

No branches or pull requests

2 participants