Hi
We have a popup gallery of employee photos that the user can use to select an employee.
There are also a couple of other ways the user can select an employee. If the user uses one of these ways, then we want to update the photo in the popup gallery preview area (as if the user selected it).
I can't find a way to do this. I've tried gallery.selecteditem and photo.bringintoview.
Thanks
I was able to do this with the SelectedItem property and BringIntoView method with this code:
PopupGalleryTool rootTool = (PopupGalleryTool)this.ultraToolbarsManager1.Tools["PopupGalleryTool1"];PopupGalleryTool instanceTool = (PopupGalleryTool)rootTool.SharedProps.ToolInstances[0];
rootTool.SelectedItem = rootTool.Items["Item5"];rootTool.SelectedItem.BringIntoView(instanceTool, null, GalleryArea.Preview);
HI
I have the same problem as Keltyx. I tried it with the solution from Mike but it didn't work. Is there a other solution for this problem.
GetPopupGalleryTool(KEY_PG_DATAINPUT_TEMPLATESELECTION).SelectedItemKey = m_oRibbonMenuViewModel.Template
If Not GetPopupGalleryTool(KEY_PG_DATAINPUT_TEMPLATESELECTION).UIElement Is Nothing Then GetPopupGalleryTool(KEY_PG_DATAINPUT_TEMPLATESELECTION).SelectedItem.BringIntoView(GetPopupGalleryTool(KEY_PG_DATAINPUT_TEMPLATESELECTION).SharedProps.ToolInstances(0), Nothing, GalleryArea.Preview)
End If
Private Function GetPopupGalleryTool(ByVal i_strKey As String) As PopupGalleryTool
Return CType(tbChannelPreCalc.Tools(i_strKey), PopupGalleryTool)
End Function
UIElement will always be null on the tool returned from GetPopupGalleryTool, so your code will never enter the If block. That is because GetPopupGalleryTool returns a root tool, which is never actually displayed, but which is used as a place to hold shared properties for instance tools with the same type and key. You really want to check the UIElement of an instance tool. I also suggest caching that tool in a local variable so you don't have to call GetPopupGalleryTool mulitple times. Here is how I might rewrite your code to make this work:
Dim rootTool As ToolBase = GetPopupGalleryTool(KEY_PG_DATAINPUT_TEMPLATESELECTION)Dim instanceTool As ToolBase = rootTool.SharedProps.ToolInstances(0)
rootTool.SelectedItemKey = m_oRibbonMenuViewModel.Template
If Not instanceTool.UIElement Is Nothing Then rootTool.SelectedItem.BringIntoView(instanceTool, Nothing, GalleryArea.Preview)End If
Private Function GetPopupGalleryTool(ByVal i_strKey As String) As PopupGalleryTool Return CType(tbChannelPreCalc.Tools(i_strKey), PopupGalleryTool)End Function
Thank you for the fast answer. I tried it with your code snipped but the popupgallery still shows the item which i have selected with the mouse. The BringIntoView function is called but it has no effect on the gallery.
Can you post a small sample reproducing the issue?