Hello,
is it possible to modify the presentation of the dettings in teh WebCam Settings dialog? My client would like to have the settings shown in a collapsible panel on the form, they do not like the dialog window. What options do we have for overriding this UI?
thanks!
-David
1 Answer, 1 is accepted
Hello, David,
The settings dialog that RadWebCam offers is designed to be displayed as a standalone form. Even though it is possible to host a Form in another control, the CameraSettingsDialog relies on the internal MediaSettingsViewModel and the internal WebCamPresenter. It is specifically implemented in such a way that we don't have public access to these fields and classes.
The possible solution that I can suggest is to simulate showing the dialog so we can access the initialized dialog and add the respective controls to the collapsible panel. I have prepared a sample project for your reference. Please give it a try and see how it works for your scenario:
I hope this information helps. If you need any further assistance please don't hesitate to contact me.
Regards,
Dess | Tech Support Engineer, Principal
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, David,
You can move the RadCollapsiblePanel in the designer and put it on the right side of RadWebCam. Then, set the radCollapsiblePanel.ExpandDirection property to Right:
We have used the sample you gave us and it does show the controls in the panel, but when I try to adjust any of the camera settings we get this error. (we also get this error when running the sample project)
at Telerik.Windows.MediaFoundation.BaseMediaFoundationPresenter.SettingsViewModel_ItemPropertyChanged(Object sender, ItemPropertyChangedEventArgs e)at Telerik.Windows.MediaFoundation.MediaSettingsViewModel.CollectionItemPropertyChanged(Object sender, ItemPropertyChangedEventArgs e)
at Telerik.Windows.MediaFoundation.SettingsViewModelBase.OnItemPropertyChanged(ItemPropertyChangedEventArgs e)
at Telerik.Windows.MediaFoundation.SettingsViewModelBase.CollectionItemPropertyChanged(Object sender, PropertyChangedEventArgs e)
at Telerik.Windows.MediaFoundation.SettingItemModelBase.OnPropertyChanged(String name)
at Telerik.Windows.MediaFoundation.SettingItemModelBase.set_Value(Int32 value)
at Telerik.WinControls.UI.CameraSetting.RadTrackBarValue_Scroll(Object sender, ScrollEventArgs e)
at System.Windows.Forms.ScrollableControl.OnScroll(ScrollEventArgs se)
at Telerik.WinControls.UI.RadTrackBar.trackBarElement_Scroll(Object sender, ScrollEventArgs e)
at Telerik.WinControls.UI.RadTrackBarElement.OnScroll(ScrollEventArgs e)
at Telerik.WinControls.UI.RadTrackBarElement.FireScrollEvent(Int32 oldValue)
at Telerik.WinControls.UI.TrackBarBodyElement.PerformMouseClick(MouseEventArgs e)
at Telerik.WinControls.UI.TrackBarBodyElement.OnMouseDown(MouseEventArgs e)
at Telerik.WinControls.RadElement.OnCLREventsRise(RoutedEventArgs args)
at Telerik.WinControls.RadElement.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args)
at Telerik.WinControls.RadItem.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args)
at Telerik.WinControls.RadElement.RaiseRoutedEvent(RadElement sender, RoutedEventArgs args)
at Telerik.WinControls.RadElement.DoMouseDown(MouseEventArgs e)
at Telerik.WinControls.RadElement.CallDoMouseDown(MouseEventArgs e)
at Telerik.WinControls.ComponentInputBehavior.OnMouseDown(MouseEventArgs e)
at Telerik.WinControls.RadControl.OnMouseDown(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at Telerik.WinControls.RadControl.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, WM msg, IntPtr wparam, IntPtr lparam)
at Interop.User32.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.Interop.Mso.IMsoComponentManager.FPushMessageLoop(UIntPtr dwComponentID, msoloop uReason, Void* pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(msoloop reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(msoloop reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at DuncanCamApp2.Program.Main() in C:\Users\david\source\repos\DuncanCamApp2\InitialConcepts-Camera\master\DuncanCamApp2\Program.cs:line 17
Hello, David,
I believe that the following forum post would help you for achieving the custom requirement with camera buttons on the right side:
https://www.telerik.com/forums/custom-buttons-for-webcam#5393811
As to the error message, I was unable to observe similar behavior on my end. Please refer to the attached gif file illustrating the behavior on my end with the specified version.
I am looking forward to your reply.
Hello, David,
As you have already found out, if the AutoStart property is set to false, it is necessary to initialize the camera with a specific device:
https://docs.telerik.com/devtools/winforms/controls/webcam/connect-to-camera-device
Then, start the camera and call the ShowSettingsDialog method to force creating the settings controls. The appropriate way to do it is the form's Load event:
public RadForm1()
{
InitializeComponent();
this.radWebCam1.SettingsDialogShowing += radWebCam1_SettingsDialogShowing;
this.radWebCam1.AutoStart = false;
}
private void RadForm1_Load(object sender, EventArgs e)
{
ReadOnlyCollection<MediaFoundationDeviceInfo> videoDevices = RadWebCam.GetVideoCaptureDevices();
ReadOnlyCollection<MediaFoundationVideoFormatInfo> videoFormats = RadWebCam.GetVideoFormats(videoDevices[0], true);
ReadOnlyCollection<MediaFoundationDeviceInfo> audioDevices = RadWebCam.GetAudioCaptureDevices();
radWebCam1.Initialize(videoDevices[0], videoFormats[9], null);
radWebCam1.Start();
this.radWebCam1.ShowSettingsDialog();
this.radWebCam1.WebCamElement.SettingsButton.Visibility = ElementVisibility.Collapsed;
}