This is a migrated thread and some comments may be shown as answers.

Problem on Strip Button To View Hidden Pages

8 Answers 128 Views
PageView
This is a migrated thread and some comments may be shown as answers.
Vijay Kumar Vegulla
Top achievements
Rank 1
Vijay Kumar Vegulla asked on 01 Mar 2011, 10:17 AM
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

8 Answers, 1 is accepted

Sort by
0
Vijay Kumar Vegulla
Top achievements
Rank 1
answered on 01 Mar 2011, 10:20 AM
Please provide any info on this
0
Richard Slade
Top achievements
Rank 2
answered on 01 Mar 2011, 11:38 AM
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
0
Richard Slade
Top achievements
Rank 2
answered on 01 Mar 2011, 11:40 AM
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
0
Richard Slade
Top achievements
Rank 2
answered on 01 Mar 2011, 01:38 PM
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
0
Emanuel Varga
Top achievements
Rank 1
answered on 01 Mar 2011, 02:23 PM
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
0
Richard Slade
Top achievements
Rank 2
answered on 02 Mar 2011, 09:09 AM
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
0
Vijay Kumar Vegulla
Top achievements
Rank 1
answered on 02 Mar 2011, 10:00 AM
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
0
Richard Slade
Top achievements
Rank 2
answered on 02 Mar 2011, 10:09 AM
Glad that you have this working. Please remember to mark all helpful posts as answer.
Regards,
Richard
Tags
PageView
Asked by
Vijay Kumar Vegulla
Top achievements
Rank 1
Answers by
Vijay Kumar Vegulla
Top achievements
Rank 1
Richard Slade
Top achievements
Rank 2
Emanuel Varga
Top achievements
Rank 1
Share this question
or