Designer.cs 属性未保留为公共 [英] Designer.cs properties not keeping as Public

查看:36
本文介绍了Designer.cs 属性未保留为公共的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近不知道为什么,但 Designer.cs 文件中的属性会自动更改为私有而不是我手动设置的公共.

Recently Not sure why but properties in Designer.cs file is automatically changing to private instead public I have manually set.

[Outlet]
    [GeneratedCode ("iOS Designer", "1.0")]
    public UIKit.UIButton btnEditRow { get; set; }

一段时间后.

[Outlet]
    [GeneratedCode ("iOS Designer", "1.0")]
    UIKit.UIButton btnEditRow { get; set; }

推荐答案

这是自动生成的代码,将其更改为公共不是解决方案.Xamarin 将再次将其更新为原始版本.这就是过程.如果要从其他类访问它,请在 .cs 文件中创建该控件的 get 属性.

That's Auto generated code, changing that to public is not solution. Xamarin will update it again to original. that's process. If you want to access it from other class, create get property of that control in .cs file.

例如

public UIButton btn_EditRow
        {
            get{
                return btnEditRow;
            }

    }

您可以从其他类访问 btn_EditRow.

You can access btn_EditRow from other class.

这篇关于Designer.cs 属性未保留为公共的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆