我正在尝试使用自动 IReference 到可见性转换将可见性绑定到
ToggleButton::IsChecked
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<CheckBox x:Name="myButton" Content="Click Me" />
<TextBlock Text="Hello" Visibility="{x:Bind myButton.IsChecked, Mode=OneWay}"/>
</StackPanel>
在空白项目中这是可行的。在我现有的项目中,如果我提供自己的转换器,它就会工作,但如果我尝试使用自动转换,我会得到:
error C3779: 'winrt::impl::consume_Windows_Foundation_IReference<
winrt::Windows::Foundation::IReference<bool>,T>::Value':
a function that returns 'auto' cannot be used before it is defined
with [ T=bool ] (compiling source file Generated Files\XamlTypeInfo.g.cpp)