Problem on Strip Button To View Hidden Pages

9 posts, 0 answers
  1. Vijay Kumar Vegulla
    Vijay Kumar Vegulla avatar
    14 posts
    Member since:
    Apr 2010

    Posted 01 Mar 2011 Link to this post

    Hi,

    I have a problem in RadPageView. If I click twise on the Strip Button to view the hidden pages, surprisingly context is menu is loading twise in the same. I found the same problem in "Run Demo" application also.

    Find the attached screen shot for clear understangin of the problem. Please provide any information to solve this issue.


    Thanks
    vijay

  2. Vijay Kumar Vegulla
    Vijay Kumar Vegulla avatar
    14 posts
    Member since:
    Apr 2010

    Posted 01 Mar 2011 Link to this post

    Please provide any info on this
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 01 Mar 2011 Link to this post

    Hello Vijay,

    May I ask what version you are using? Perhaps I have not done something to replicate this the way that you have, but I am not able to produce the same result at the moment. I am using the latest Q3 2010 SP1 version for reference.

    If you are not using the latest version, I would advise that you upgrade. If you are, then please could you describe again how to reproduce this issue
    Thanks
    Richard
  5. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 01 Mar 2011 Link to this post

    Hello Vijay,

    Ok, I have managed to replicate it. You have to quickly double click, not just click twice. This is obviously a bu that will need to be addressed by the Telerik team. I will send off a bug report for it. In the meantime I will look for a workaround for you.
    Richard
  6. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 01 Mar 2011 Link to this post

    Hi,

    Ok, I've got a workaround for you. It's not pretty but seems to do the job.

    1: Firstly, at class level, define a Timer
    private Timer m_Timer = new Timer();

    2: In the form load, add an event handler for the mouse down of the Available Items button and to the timer tick
    RadPageViewStripElement strip = this.radPageView2.ViewElement as RadPageViewStripElement;
    strip.ItemContainer.ButtonsPanel.ItemListButton.MouseDown += new MouseEventHandler(ItemListButton_MouseDown);
    m_Timer.Tick += new EventHandler(m_Timer_Tick);

    3: On double click of the button, disable it and start the timer
    void ItemListButton_MouseDown(object sender, MouseEventArgs e)
    {
        if (e.Button == System.Windows.Forms.MouseButtons.Left)
        {
            if (e.Clicks > 1)
            {
                RadPageViewStripElement strip = this.radPageView2.ViewElement as RadPageViewStripElement;
                strip.ItemContainer.ButtonsPanel.ItemListButton.Enabled = false;
                m_Timer.Interval = 500;
                m_Timer.Start();   
            }
        }
    }

    4: And on the timer tick, re-enable the button and stop the timer
    void m_Timer_Tick(object sender, EventArgs e)
    {
        RadPageViewStripElement strip = this.radPageView2.ViewElement as RadPageViewStripElement;
        strip.ItemContainer.ButtonsPanel.ItemListButton.Enabled = true;
        m_Timer.Stop();
    }

    Hope that helps. I've sent a bug report to telerik. I'll let you know when I get a response
    richard
  7. Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 01 Mar 2011 Link to this post

    Hello guys,

    Ok, so i have a workaround for you but it is based on reflection, because telerik was just clearing the context menu items on close, and because the context menu is not closing you will always have the old items in the menu.

    public Form1()
    {
        InitializeComponent();
        var strip = this.radPageView1.ViewElement as RadPageViewStripElement;
     
        strip.StripButtons = StripViewButtons.All;
        var stripViewItemsContainer = strip.Children[0] as StripViewItemContainer;
        var stripViewButtonsPanel = stripViewItemsContainer.Children[1] as StripViewButtonsPanel;
     
        stripViewButtonsPanel.ItemListButton.MouseDown += new MouseEventHandler(ItemListButton_MouseDown);
    }
     
    void ItemListButton_MouseDown(object sender, MouseEventArgs e)
    {
        var contextMenu = typeof(RadPageViewElement).GetFields(System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).
            Where(f=>f.FieldType == typeof(RadContextMenu)).FirstOrDefault();
         
        //either clear the exiting context menu
        var instanceContextMenu = contextMenu.GetValue(radPageView1.ViewElement) as RadContextMenu;
        if (instanceContextMenu != null)
        {
            instanceContextMenu.Items.Clear();
        }
     
        // or create a new one
        //contextMenu.SetValue(radPageView1.ViewElement, new RadContextMenu());
    }

    Hope this helps, if you have any other questions or comments, please let me know,

    Best Regards,
    Emanuel Varga
    Telerik WinForms MVP
  8. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 02 Mar 2011 Link to this post

    Hi All,

    Stefan from the Telerik team has let me know that this is a known issue and is fixed in the Q1 2011 release that is due out the middle of this month.
    Regards
    Richard
  9. Vijay Kumar Vegulla
    Vijay Kumar Vegulla avatar
    14 posts
    Member since:
    Apr 2010

    Posted 02 Mar 2011 Link to this post

    Hi,

    Thanks to all. I used Emanuel Varga's solution and it worked. But it would be nice to have with the controls itself. Hope this will be solved in future release.

    Thank you
    vijay
  10. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 02 Mar 2011 Link to this post

    Glad that you have this working. Please remember to mark all helpful posts as answer.
    Regards,
    Richard
Back to Top
UI for WinForms is Visual Studio 2017 Ready