如何解决向 VM 发送字节不起作用 Xamarin
我有行为
public class FolderDialogBehavior : Behavior<View>
{
public byte[] ImageBytes{ get { return (byte[])GetValue(ImageBytesProperty); } set { SetValue(ImageBytesProperty,value); } }
public readonly static BindableProperty ImageBytesProperty = BindableProperty.Create(nameof(ImageBytes),typeof(byte[]),typeof(FolderDialogBehavior),defaultValue: null,BindingMode.TwoWay);
// Some Code
private async void GetPhotoAsync()
{
// Some Code
ImageBytes = bytes;
}
}
我也有 ViewModel
public class StudentViewModel : OnPropertyChangedClass
{
private byte[] _userImage;
public byte[] UserImage
{
get => _userImage;
set => SetProperty(ref _userImage,value);
}
}
问题是 ImageBytes 不向我的 ViewModel 发送新信息。 如果我将 byte[] 更改为 string
一切正常<Grid Content BindingContext="{Binding AddEmployee,Mode=OneWay}">
<Grid.Behaviors>
<local:FolderDialogBehavior ImageBytes="{Binding StudentObject.UserImage,Mode=TwoWay}"/>
</Grid.Behaviors>
</Grid>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。