【问题标题】:Is there a way to bind x:Arguments of a control in XAML?有没有办法在 XAML 中绑定 x:Arguments 控件?
【发布时间】:2019-12-01 13:53:39
【问题描述】:

我试图只绑定 Int32 括号之间的值,但这段代码实际上不起作用,想知道 Xaml 是否提供了一种方法来做到这一点。

<ListView x:Name="corsiList" HasUnevenRows="True" SeparatorVisibility="None">
         <ListView.ItemTemplate>
              <DataTemplate>
                   <ViewCell>
                       <ctrls:InfoCorso Title="{Binding CorsiList.Nome}" Time="18:30" StyleColor="{Binding ButtonColor}">
                            <x:Arguments>
                                 <x:Int32>Binding Subs</x:Int32>
                                 <x:Int32>Binding Max</x:Int32>
                            </x:Arguments>
                       </ctrls:InfoCorso>
                   </ViewCell>
              </DataTemplate>
         </ListView.ItemTemplate>
</ListView>

【问题讨论】:

    标签: c# ios xaml xamarin xamarin.forms


    【解决方案1】:

    据我所知,目前我们不支持在 Xamarin 中绑定参数。

    有关在 XAML 中传递参数的信息,请参阅以下文档。

    https://docs.microsoft.com/en-us/xamarin/xamarin-forms/xaml/passing-arguments

    【讨论】:

    • @x_vale_x,如果我的回复对您有帮助,请记得将我的回复标记为答案。谢谢...
    • 即使在 MAUI 中仍然不可能吗?
    【解决方案2】:

    您不能直接绑定到参数。

    处理此问题的最佳方法是向 InfoCorso 用户控件添加一些可绑定属性,然后更新后面代码中的参数。

    看起来您已经有了 Title 的可绑定属性,但如果您需要更多信息,请查看此链接

    https://docs.microsoft.com/en-us/xamarin/xamarin-forms/xaml/bindable-properties

    【讨论】:

    • 我不能,因为我必须在初始化组件中执行微积分操作
    猜你喜欢
    • 2010-09-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-31
    • 2016-05-29
    • 2016-11-05
    • 2012-07-07
    • 1970-01-01
    相关资源
    最近更新 更多