【发布时间】:2023-04-02 11:51:01
【问题描述】:
我正在使用 xamarin.forms 制作应用程序。
我有一个名为 AAStackLayout 的类,它内部有一个 Image。
我使用 xaml 在名为 AAContentPage 的页面上添加 AAStackLayout。
那么,如何使用 xaml 从 AAContentPage 访问布局的图像,以便我可以更改其可绑定属性?
类似的东西:
AAContentPage.xaml
<ContentPage>
<local:AAStackLayout>
<local:AAStackLayout.MyImage>
<source="AAA.jpg"/>
</local:AAStackLayout.MyImage>
</local:AAStackLayout>
</ContentPage>
AAStackLayout.xaml
<StackLayout>
<Image x:Name="MyImage"/>
</StackLayout>
我想要的是编辑已经添加的 Image 的可绑定属性。我没有尝试添加新图片。
另外,我知道我可以添加与 Image 相同的可绑定属性并将其应用于 Image。但我认为这不是最好的方法。
谢谢。
【问题讨论】:
标签: wpf xaml xamarin xamarin.forms