【问题标题】:How can I specify a ViewModel class within a class in XAML如何在 XAML 中的类中指定 ViewModel 类
【发布时间】:2020-09-27 16:56:51
【问题描述】:

我有一些 XAML

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:model="clr-namespace:SmartCubeMobile;assembly=XFMultiPicker"
             xmlns:xfMultiPicker="clr-namespace:XFMultiPicker;assembly=XFMultiPicker"
             x:Class="XFMultiPicker.MainPage">

    <StackLayout>
        <xfMultiPicker:MultiPickerView x:TypeArguments="model:AddressItem1"
                                       ItemsSource="{Binding AvailableItems}"
                                       SelectedItems="{Binding SelectedItems}"/>
    </StackLayout>
</ContentPage>

后面的代码为:

namespace SmartCubeMobile
{
    public class AddressItem1
    {
        internal string Text { get; set; }
    }

    public class FinanceViewModel : INotifyPropertyChanged
    {
        public class AddressItem2
        {
            internal string Text { get; set; }
        }
    }
}

如何将 XAML x:TypeArguments 行修改为“指向”AddressItem2?似乎没有任何效果,例如"model:FinanceViewModel.AddressItem2" 和其他一切一样都失败了。有人有什么想法吗?提前感谢您的任何建议

【问题讨论】:

    标签: xaml viewmodel


    【解决方案1】:

    找到了解决方法 - 不再需要这个废话了

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-11-26
      • 1970-01-01
      • 1970-01-01
      • 2022-11-14
      • 1970-01-01
      • 2015-06-06
      • 2010-11-24
      • 1970-01-01
      相关资源
      最近更新 更多