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
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).
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
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/.
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
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/.