Hello,
We have a desktop based WPF application that is published via RDS. Randomly throughout the day the application crashes with below exception. The error is random and the user of the application or the development\support team of the application is unable to recreate this at will. Any insights regarding this would be helpful. Thank you in advance!
Exception
******************************************
Application: ntierHealth.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled
exception.
Exception Info: System.NullReferenceException
at
Telerik.Windows.Controls.WindowHost.GetGlobalMousePosition(System.Windows.UIElement,
System.Windows.Input.MouseEventArgs)
at
Telerik.Windows.Controls.InternalWindow.DragBehavior.OnElementMouseLeftButtonUp(System.Object,
System.Windows.Input.MouseButtonEventArgs)
at
System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(System.Delegate,
System.Object)
at
System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)
at
System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object, System.Windows.RoutedEventArgs)
at
System.Windows.EventRoute.InvokeHandlersImpl(System.Object,
System.Windows.RoutedEventArgs, Boolean)
at
System.Windows.UIElement.ReRaiseEventAs(System.Windows.DependencyObject,
System.Windows.RoutedEventArgs, System.Windows.RoutedEvent)
at
System.Windows.UIElement.OnMouseUpThunk(System.Object,
System.Windows.Input.MouseButtonEventArgs)
at
System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(System.Delegate,
System.Object)
at System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate,
System.Object)
at
System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object,
System.Windows.RoutedEventArgs)
at
System.Windows.EventRoute.InvokeHandlersImpl(System.Object,
System.Windows.RoutedEventArgs, Boolean)
at
System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject,
System.Windows.RoutedEventArgs)
at
System.Windows.UIElement.RaiseTrustedEvent(System.Windows.RoutedEventArgs)
at
System.Windows.UIElement.RaiseEvent(System.Windows.RoutedEventArgs, Boolean)
at
System.Windows.Input.InputManager.ProcessStagingArea()
at
System.Windows.Input.InputManager.ProcessInput(System.Windows.Input.InputEventArgs)
at
System.Windows.Input.InputProviderSite.ReportInput(System.Windows.Input.InputReport)
at
System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr,
System.Windows.Input.InputMode, Int32, System.Windows.Input.RawMouseActions,
Int32, Int32, Int32)
at
System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr, MS.Internal.Interop.WindowMessage,
IntPtr, IntPtr, Boolean ByRef)
at
System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr, Int32, IntPtr,
IntPtr, Boolean ByRef)
at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32,
IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
at
System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate,
System.Object, Int32)
at
System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object,
System.Delegate, System.Object, Int32, System.Delegate)
at
System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority,
System.TimeSpan, System.Delegate, System.Object, Int32)
at
MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
at
MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
at
System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
at System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame)
at
System.Windows.Application.RunDispatcher(System.Object)
at
System.Windows.Application.RunInternal(System.Windows.Window)
at
System.Windows.Application.Run(System.Windows.Window)
at Mdrx.PM.Client.Shell.App.Main()
******************************************
Hello,
First, I'm loading a PropertyGrid with dynamically generated PropertyDefintions at run-time, instead of hard coded XAML. Second, for one PropertyGrid entry, I'm trying to load a Combobox whose model includes both a value and the list of items to show in the Combobox. Unfortunately when I try to do this, I just get a blank Combobox (nothing in either the entry or the dropdown list) and an error:
System.Windows.Data Error: 40 : BindingExpression path error: 'Items' property not found on 'object' ''ObservableCollection`1' (HashCode=35225966)'. BindingExpression:Path=Items; DataItem='ObservableCollection`1' (HashCode=35225966); target element is 'RadComboBox' (Name=''); target property is 'ItemsSource' (type 'IEnumerable')
So obviously XAML does not "see" Items from the model, but I thought I had everything defined properly (see code below). So I'm missing something somewhere. Or maybe something is not structured right. I've looked at several example projects given in this forum, but nothing works or the sample does not fit what I'm trying to do.
The goal is to emulate an Enum but make it dynamic by loading the Comboxbox with dynamically generated lists, and I want both the entry and the list of items to be dynamically generated in the model. Any suggestions would be welcome!!
Thanks in advance
Here is where the property definitions are being loaded
private void Window_Loaded(object sender, RoutedEventArgs e){ PropertyDefinitionCollection properties = EditorPropertyGrid.PropertyDefinitions; ObservableCollection<object> testList = new ObservableCollection<object>();// WORKS
TestEnumKeyValue first = new TestEnumKeyValue() { Key = "Static Enum Prop", Value = TestEnum.test3 }; testList.Add(first); properties.Add(new PropertyDefinition() { DisplayName = first.Key, Binding = new Binding("Value") { Source = first } });// DOES NOT WORK
ComboListKeyValue third = new ComboListKeyValue() { Key = "List Prop", Value = "A3" }; testList.Add(third); properties.Add(new PropertyDefinition() { DisplayName = third.Key, Binding = new Binding("Value") { Source = third } , EditorTemplate = (DataTemplate)EditorGrid.Resources["ComboBoxTemplate"] }); EditorPropertyGrid.Item = testList;}
Here is the model
enum TestEnum{ test1, test2, test3}abstract class KeyValueBase{ public string Key { get; set; }}class TestEnumKeyValue : KeyValueBase{ public TestEnum Value { get; set; }}class ComboListKeyValue : KeyValueBase, INotifyPropertyChanged{ public event PropertyChangedEventHandler PropertyChanged; private string _value; private List<string> _values; public ComboListKeyValue() { _values = new List<string>() // list for combobox dynamically generated here { "A1", "A2", "A3", "A4" }; } public string Value { get { return this._value; } set { if (value != this._value) { this._value = value; this.OnPropertyChanged("Value"); } } } public List<string> Items { get { return _values; } set { _values = value; } } protected virtual void OnPropertyChanged(PropertyChangedEventArgs args) { PropertyChangedEventHandler handler = this.PropertyChanged; if (handler != null) { handler(this, args); } } private void OnPropertyChanged(string propertyName) { this.OnPropertyChanged(new PropertyChangedEventArgs(propertyName)); }}
And here is the XAML
<Grid x:Name="EditorGrid"> <Grid.Resources> <DataTemplate x:Key="ComboBoxTemplate"> <telerik:RadComboBox ItemsSource="{Binding Items, Mode=OneWay}" SelectedValue="{Binding Value}"/> </DataTemplate> </Grid.Resources> <telerik:RadPropertyGrid x:Name="EditorPropertyGrid" Margin="10,10,10,10" DescriptionPanelVisibility="Collapsed" SearchBoxVisibility="Collapsed" AutoGeneratePropertyDefinitions="False" NestedPropertiesVisibility="Visible" AutoGenerateBindingPaths="False" SortAndGroupButtonsVisibility="Collapsed" /></Grid>
Thanks!
Hello,
I'm using the RadCartesianChart to display a dynamic number of series using two y-axis. I'd like to set the style of the vertical axis title. Any help would be appreciated.
When I have one y-axis, I can do this:
<telerik:RadCartesianChart.VerticalAxis> <telerik:LinearAxis Minimum="0" x:Name="verticalAxis" HorizontalLocation="Left" MajorTickStyle="{StaticResource tickStyle}" LineThickness="1.5" LineStroke="Gray" LabelStyle="{StaticResource axisLabelStyle}" > <telerik:LinearAxis.Title> <TextBlock FontWeight="Bold" FontSize="13" x:Name="txtYAxisTitle"/> </telerik:LinearAxis.Title> </telerik:LinearAxis></telerik:RadCartesianChart.VerticalAxis>
But Since I can only create one y-axis this way, I can't do it this way. Instead, I have created two y-axis dynamically. When I do that, I don't know how to set the style of the title (ie. txtYAxisTitle from above). This is what I have that isn't working:
LinearAxis verticalAxisOne = new LinearAxis();verticalAxisOne.Style = Resources["AxisTitleStyle"] as Style;
Hello Telerik,
in the WPF RadRichTextBox I have this example text:
"Hello my friend, everything is great today".
Now the user selects only the word 'great' and I want to increase the fontsize +2 only for this word.
My code looks like this:
private async Task<bool> FormatIncreaseFont()
{
await Task.Delay(1);
double newFontSize = 0;
var boxes = RichTextBox.Document.Selection.GetSelectedBoxes();
foreach (var box in boxes)
{
//AssociatedDocumentElement is wrong.
Span span = box.AssociatedDocumentElement as Span;
if (span != null)
{
newFontSize = (newFontSize == 0) ? Math.Round(Unit.DipToPoint(span.FontSize), 0) + 2 : newFontSize;
//span.FontSize is also wrong
span.FontSize = Unit.PointToDip(newFontSize);
}
}
RichTextBox.UpdateEditorLayout();
return true;
}
AssociatedDocumentElement is the span where the InlineLayoutBox lives in, so I get the wrong font size.
Also I am changing the font size of the whole span, not only the InlineLayoutBox .
My questions are:
1.) How do I get the current font size of the InlineLayoutBox ("great").
2.) How do I then change the font size only for this InlineLayoutBox ("great").
Thank you!



<UserControl x:Class="FcWpfTabControl.AnotherTab" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" xmlns:xx="clr-namespace:FcWpfTabControl" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300"> <UserControl.Resources> <Style x:Key="CloseButton" TargetType="{x:Type Button}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="Button"> <ControlTemplate.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Trigger.EnterActions> <BeginStoryboard x:Name="MouseOverBeginStoryboard"> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="FocusEllipse"> <DiscreteObjectKeyFrame KeyTime="0"> <DiscreteObjectKeyFrame.Value> <Visibility>Visible</Visibility> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames> <ColorAnimation Duration="0" To="LightGray" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="FocusEllipse" /> </Storyboard> </BeginStoryboard> </Trigger.EnterActions> <Trigger.ExitActions> <StopStoryboard BeginStoryboardName="MouseOverBeginStoryboard" /> </Trigger.ExitActions> </Trigger> <Trigger Property="IsPressed" Value="True"> <Trigger.EnterActions> <BeginStoryboard x:Name="IsPressedBeginStoryboard"> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="FocusEllipse"> <DiscreteObjectKeyFrame KeyTime="0"> <DiscreteObjectKeyFrame.Value> <Visibility>Visible</Visibility> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames> <ColorAnimation Duration="0" To="DarkGray" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="FocusEllipse" /> </Storyboard> </BeginStoryboard> </Trigger.EnterActions> <Trigger.ExitActions> <StopStoryboard BeginStoryboardName="IsPressedBeginStoryboard" /> </Trigger.ExitActions> </Trigger> </ControlTemplate.Triggers> <Grid Background="Transparent" Width="14" Height="14"> <Ellipse x:Name="FocusEllipse" Fill="#FFF13535" Visibility="Collapsed" /> <ContentPresenter x:Name="ContentPresenter" Content="{TemplateBinding Content}" HorizontalAlignment="Center" VerticalAlignment="Center" /> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style x:Key="ClosableStyle" TargetType="telerik:RadTabItem"> <Setter Property="HeaderTemplate"> <Setter.Value> <DataTemplate> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="*" /> <ColumnDefinition Width="Auto" /> </Grid.ColumnDefinitions> <TextBlock Text="{Binding Title}" /> <telerik:RadButton Grid.Column="1" Style="{StaticResource CloseButton}" Width="16" Height="16" Margin="10,0,0,0" ToolTipService.ToolTip="Remove item" xx:RoutedEventHelper.EnableRoutedClick="True" Padding="0" > <ContentControl> <Path Data="M0,0 L6,6 M6, 0 L0,6" Stroke="Black" StrokeThickness="1" SnapsToDevicePixels="True" /> </ContentControl> </telerik:RadButton> </Grid> </DataTemplate> </Setter.Value> </Setter> <Setter Property="ContentTemplate"> <Setter.Value> <!--<ContentControl Content="{Binding Content}"/>--> <DockPanel Name="panel1" LastChildFill="True"> <WindowsFormsHost Name="wfHost" DockPanel.Dock="Left" Child="{Binding Content}"/> </DockPanel> </Setter.Value> </Setter> </Style> </UserControl.Resources> <Grid x:Name="LayoutRoot" Background="White"> <telerik:RadTabControl x:Name="tabControl" ItemContainerStyle="{StaticResource ClosableStyle}"> </telerik:RadTabControl> </Grid></UserControl>using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Imaging;using System.Windows.Navigation;using System.Windows.Shapes;using Telerik.Windows.Controls;using System.Collections.ObjectModel;using System.Windows.Forms.Integration;using System.Windows.Forms;namespace FcWpfTabControl{ /// <summary> /// Interaction logic for AnotherTab.xaml /// </summary> public partial class AnotherTab : System.Windows.Controls.UserControl { public AnotherTab() { InitializeComponent(); EventManager.RegisterClassHandler(typeof(RadTabItem), RoutedEventHelper.CloseTabEvent, new RoutedEventHandler(OnCloseClicked)); } ObservableCollection<TabItemModel> tabItemsModel = new ObservableCollection<TabItemModel>(); public void OnCloseClicked(object sender, RoutedEventArgs e) { var tabItem = sender as RadTabItem; // Remove the item from the collection the control is bound to tabItemsModel.Remove(tabItem.DataContext as TabItemModel); } public void CreateTabItem(UserControl uc) { // Create items: RadTabItem Item1 = new RadTabItem(); WindowsFormsHost wfh = new WindowsFormsHost(); wfh.Child = uc; Item1.Content = wfh; Item1.Header = "Tab1"; TabItemModel tb = new TabItemModel("Item", uc); // tb.userControl = uc; tabItemsModel.Add(tb); // tabItemsModel[0].Content.Child = uc; tabControl.ItemsSource = tabItemsModel; } } public class TabItemModel { public TabItemModel(string stringTitle, UserControl uc) { WindowsFormsHost wfh = new WindowsFormsHost(); //wfh.Child = uc; Title = stringTitle; Content = wfh; } public String Title { get; set; } public UserControl userControl { get; set; } public WindowsFormsHost Content { get; set; } }}using System;using System.Collections.Generic;using System.Linq;using System.Text;using Telerik.Windows.Controls;using System.Windows;using System.Windows.Controls;using Telerik.Windows;namespace FcWpfTabControl{ public class RoutedEventHelper { //Create the routed event: public static readonly RoutedEvent CloseTabEvent = EventManager.RegisterRoutedEvent( "CloseTab", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(RoutedEventHelper)); //Add an attached property: public static bool GetEnableRoutedClick(DependencyObject obj) { return (bool)obj.GetValue(EnableRoutedClickProperty); } public static void SetEnableRoutedClick(DependencyObject obj, bool value) { obj.SetValue(EnableRoutedClickProperty, value); } // Using a DependencyProperty as the backing store for EnableRoutedClick. // This enables animation, styling, binding, etc... public static readonly DependencyProperty EnableRoutedClickProperty = DependencyProperty.RegisterAttached( "EnableRoutedClick", typeof(bool), typeof(RoutedEventHelper), new System.Windows.PropertyMetadata(OnEnableRoutedClickChanged)); private static void OnEnableRoutedClickChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) { var newValue = (bool)e.NewValue; var button = sender as Button; if (button == null) return; if (newValue) button.Click += new RoutedEventHandler(OnButtonClick); } static void OnButtonClick(object sender, RoutedEventArgs e) { var control = sender as Control; if (control != null) { control.RaiseEvent(new RadRoutedEventArgs(RoutedEventHelper.CloseTabEvent, control)); } } }}Hello,
I have a requirement to display two x-axis for a single series. The data is a collection of measurements and the client would like to see each point relative to the start and also relative to the end. For example, if there are 10 points along a 100m distance, the third point is 30m from the start, and 70m from the end. Is there a way to accommodate this?
So far I have only found a way to make multiple x-axis for a chart, but each series in that chart only has one x-axis. My only thought was to create a second series with reverse data that would be included, but hidden under the first data since they line up perfectly. Is there another way? Thanks.

Hallo, I'm using RadWebCam control into a UserControl and everything works as expected.
So, if I call myradwebcam.TakeSnapShot() within the UserControl that contains the RadWebCam control, everything is ok.
But if I call myradwebcam.TakeSnapShot() from another class (i.e. another UserControl) I receive a System.NullReferenceException.
Am I doing something wrong?
Thank's,
Luca
P.S. Here the exception:
System.NullReferenceException
HResult=0x80004003
Messaggio=Riferimento a un oggetto non impostato su un'istanza di oggetto.
Origine=Telerik.Windows.Controls.Media
Analisi dello stack:
in Telerik.Windows.Controls.RadWebCam.TakeSnapshot()
in TestVisoreIfm.Pannello_Dashboard.btnScansione_Click(Object sender, RoutedEventArgs e) in D:\repos\TestVisoreIfm\Pannello_Dashboard.xaml.cs: riga 517