Skip to content

Bug:Since 2.0.240111.5, I get a compile error with the GetTemplateChild function. #1393

@takatsuka2022

Description

@takatsuka2022

Version

2.0.240111.5

Summary

I think GetTemplateChild was a public function, but since 2.0.240111.5 it has been changed to protected, so I cannot access it from outside the class.
Is there a workaround for this?

Reproducible example

.xaml
<ColorPicker x:Name="MemoColorPicker" Grid.Row="0" Grid.Column="1" Margin="20,10,30,0"
 ColorSpectrumShape="Box" IsAlphaSliderVisible="False" IsColorPreviewVisible="False"
 IsColorChannelTextInputVisible="False" IsHexInputVisible="False" IsColorSliderVisible="False"/>


.cpp
auto spectrum = MemoColorPicker().GetTemplateChild(L"ColorSpectrum").try_as<Controls::Primitives::ColorSpectrum>();
if (spectrum != nullptr) {
    auto tool_chip = spectrum.GetTemplateChild(L"ColorNameToolTip").try_as<Controls::ToolTip>();
    if (tool_chip != nullptr) tool_chip.Visibility(Visibility::Collapsed);
}

Expected behavior

No response

Actual behavior

No response

Additional comments

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions