• LinksPersistInfo not work!


    from:http://www1.devexpress.com/Support/Center/p/DB26046.aspx

    This code works only when called from within InitializeComponent() method. If it is invoked later it won't add anything visually (skinItm is BarSubItem placed on an XtraBar).

    BarButtonItem tubo = new DevExpress.XtraBars.BarButtonItem();

    tubo.Caption = "XXX";

    tubo.Name = "Meho";

    barManager.Items.Add(tubo);

    skinItm.LinksPersistInfo.Add(new LinkPersistInfo(tubo));
    <-     Reviewed by DevExpress Team         2006/8/9 5:50:52
    <-     Processed (By Design) by DevExpress Team         2006/8/9 10:14:06

    Please modify your code as shown below.

    Old code:

    [C#]
    skinItm.LinksPersistInfo.Add(new LinkPersistInfo(tubo));

    New code:

    [C#]
    skinItm.ItemLinks.Add(tubo);

    We also advise that you review the AddBarItemLinks tutorial project shipped with the XtraBars.

    Thank you,
    Nick
    ->     Reactivated by Miha Markic         2006/8/9 10:19:19

    Ok, thanks.
    A note here: my old code (bad or good) was working in 6.1.x and it doesn't work anymore so it could be considered as a breaking change and thus the change could be documented in what's new section.
    <-     Processed (By Design) by DevExpress Team         2006/8/9 12:51:37

    Please try to surround your old code with the BarManager.BeginInit / BarManager.EndInit method similar to the code in the InitializeComponent method. The problem should disappear.

    Thank you,
    Nick
    ->     Reactivated by Miha Markic         2006/8/9 12:56:47

    Hi Nick. Sure, I have no problems now and I will happily embrace the proper way via ItemLinks. I was just commenting that it might be good thing to leave a note in what's new section to avoid other people having the same problem.
    <-     Processed (By Design) by DevExpress Team         2006/8/10 19:03:29

    Hi Miha,

    A true developer doesn't need any documentation; source code (or .NET Reflector) is enough :-) So why does one worry about a "What's New"? ;-)

    The XtraBars' documentation suggests using either ItemLinks.Add or AddLink method to add menu items programmatically. Here is the quote from the documentation in regard to the LinksPersistInfo property:

    This member supports the .NET Framework infrastructure and cannot be used directly from your code.
    http://documentation.devexpress.com/#WindowsForms/DevExpressXtraBarsBarLinksPersistInfotopic

    I personally don't see any reason for including a similar note into the What's New document.

    Thank you,
    Nick

    P.S.
    Miha, just between you and me :-), you can use the LinksPersistInfo.Add method, if you want the added item links to persist after the end-user resets a toolbar (Quick Customize | Reset Toolbar). Please don't forget to wrap the LinksPersistInfo.Add calls with BeginInit/EndInit as suggested above. But please keep this in secret, since it is an undocumented feature and for me it might be difficult to support it if anyone starts using it. :-)

    N.

  • 相关阅读:
    实战项目-网易
    iOS-Code-Snippet
    iOS父子控制器详解
    (Java) AES-128 数据加密
    (Java) byte[] 和 base64 字符串之间的转换
    关于 mybatis 报invalid comparison: java.util.Arrays$ArrayList and java.lang.String异常
    MUI 混合开发移动app应用开发 --- app版本升级
    MUI错误信息:系统已经存在较高版本,些安装包无法安装。
    找不到 cucumber.api.cli.Main 的报错解决方案
    Mysql 索引类型+索引方法
  • 原文地址:https://www.cnblogs.com/luoyaoquan/p/2111684.html
Copyright © 2020-2023  润新知