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

host RadPopEditorElement in RadCommandBar

5 Answers 80 Views
PopupEditor
This is a migrated thread and some comments may be shown as answers.
Ali
Top achievements
Rank 1
Ali asked on 22 Aug 2020, 11:37 AM

Hi,

I need to host radpopupeditor in radcommandbar. i know i have to use radHostItem. It was possible to do but there was no way to set the associatedControl for the popupeditor because its Element does not have this property. here is the code i managed to get so far:

 

            Dim cont As New RadPopupContainer
            cont.Controls.Add(New tempControl With {.Dock = DockStyle.Fill})
            Dim pop As New RadPopupEditorElement
            pop.??? = cont
            hostFilter.HostedItem = pop

5 Answers, 1 is accepted

Sort by
0
Nadya | Tech Support Engineer
Telerik team
answered on 26 Aug 2020, 11:23 AM

Hello, Ali,

Yes, you are right that RadPopupEditorElement does not have AssociatedControl property. This property is applicable to the RadPopupEditor control.

However, it is possible to associate RadPopupEditorElement with RadPopupContainer and host it to RadCommandBar. I would like to note that RadCommandBar has CommandBarHostItem that can host any RadElement. I would recommend using CommandBarHostItem in achieving your goal. The following KB article demonstrates how you can use it: https://docs.telerik.com/devtools/winforms/knowledge-base/commandbar-hosted-item

I prepared a sample project that shows how you can associate RadPopupEditorElement with RadPopupContainer and host it in the command bar. Please refer to the following code snippet:

Public Sub New()
    InitializeComponent()

    Dim container As RadPopupContainer = New RadPopupContainer()
    Dim popupEditorElement As RadPopupEditorElement = New RadPopupEditorElement()
    popupEditorElement.PopupForm.Controls.Add(container)
    popupEditorElement.PopupContainerForm.Panel = container.PanelContainer
    popupEditorElement.MinSize = New Size(200, 0)
    Dim hostItem As CommandBarHostItem = New 
    CommandBarHostItem(popupEditorElement)
    commandBarStripElement1.Items.Add(hostItem)

End Sub

I hope this helps. If you need further assistance do not hesitate to contact me.

Regards,
Nadya
Progress Telerik

Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive , special prizes and more, for FREE?! Register now for DevReach 2.0(20).

0
pierre-jean
Top achievements
Rank 1
Veteran
Iron
answered on 10 Feb 2021, 05:14 PM

Hello

Thanks for the code snippet it works perfectly,

I just would like to change the color, bold property and the alignement of the popupeditor.
In a standard use of the popupeditor (i.e. not hosted in a commandbar) I set it as follows

            popupEditor.EditableAreaElement.TextAlignment = ContentAlignment.MiddleCenter
            popupEditor.Font = New Font(MyPreference.Font, FontStyle.Bold)
            popupEditor.ForeColor = My.Settings.PopUpColor

but I have not found how to do it when the popupeditor is hosted in the commandbar

Thanks in advance

Pierre-Jean

0
Nadya | Tech Support Engineer
Telerik team
answered on 12 Feb 2021, 09:04 AM

Hello, Perre-Jean,

In order to change the color, bold text, and alignment of the text in RadPopupEditorElement hosted in command bar you can use the following code snippet:

Dim popupEditorElement As RadPopupEditorElement = New RadPopupEditorElement()

popupEditorElement.ContainerElement.TextAlignment = ContentAlignment.MiddleCenter
popupEditorElement.Text = "popupeditor"
popupEditorElement.Font = New Font("Segoe UI", 10, FontStyle.Bold)
popupEditorElement.ForeColor = Color.Red

I hope this helps. If you have any other questions do not hesitate to contact me.

Regards,
Nadya
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
pierre-jean
Top achievements
Rank 1
Veteran
Iron
answered on 12 Feb 2021, 09:53 AM

Hello Nadya

thanks a lot for your message

actually to get the text color I had to do set it on the containerElement as follows:

        popupEditorElement.ContainerElement.ForeColor = My.Settings.PopUpColor

Setting the forecolor to the popupeditorelement itself did not do the job ...

Anyway now I get exactly what I was looking for

Thanks and Best Regards

Pierre-Jean

 

0
Nadya | Tech Support Engineer
Telerik team
answered on 12 Feb 2021, 10:21 AM

Hello, Perre-Jean,

I am glad that you managed to achieve the desired look with the pop-up editor element. In case you have other questions, do not hesitate to ask.

Regards,
Nadya
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
PopupEditor
Asked by
Ali
Top achievements
Rank 1
Answers by
Nadya | Tech Support Engineer
Telerik team
pierre-jean
Top achievements
Rank 1
Veteran
Iron
Share this question
or