Telerik Forums
UI for WPF Forum
3 answers
329 views

When I try to crop a large image (10 MB jpg), I always get an "Out of memory exception". I there a size limit for images?

 

Stack trace:

Exception of type 'System.OutOfMemoryException' was thrown.*   at Telerik.Windows.Media.Imaging.RadBitmap.GetPixels()
   at Telerik.Windows.Media.Imaging.RadBitmap.Crop(Int32 x, Int32 y, Int32 newWidth, Int32 newHeight)
   at Telerik.Windows.Media.Imaging.Commands.CropCommand.Execute(RadBitmap source, Object context)
   at Telerik.Windows.Media.Imaging.History.ImageHistory.Execute(IImageCommand command, Object context)
   at Telerik.Windows.Controls.RadImageEditor.ExecuteCommand(IImageCommand command, Object context)
   at Telerik.Windows.Controls.RadImageEditor.CommitTool(Boolean executeSameToolAfterCommit)
   at Telerik.Windows.Controls.RichTextBoxUI.Dialogs.ImageEditorDialog.OK_Click(Object sender, RoutedEventArgs e)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
   at System.Windows.Controls.Primitives.ButtonBase.OnClick()
   at System.Windows.Controls.Button.OnClick()
   at Telerik.Windows.Controls.RadButton.OnClick()
   at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
   at System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e)
   at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
   at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
   at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
   at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
   at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at System.Windows.Window.ShowHelper(Object booleanBox)
   at System.Windows.Window.Show()
   at System.Windows.Window.ShowDialog()
   at Telerik.Windows.Controls.InternalWindow.WindowWithNoChromeWindowHost.Open(Boolean isModal)
   at Telerik.Windows.Controls.WindowBase.ShowWindow(Boolean isModal)
   at Telerik.Windows.Controls.RichTextBoxUI.Dialogs.ImageEditorDialog.ShowDialogInternal(Inline orgInline, Action`2 replaceCurrentImageCallback, String executeToolName, RadRichTextBox owner)
   at Telerik.Windows.Controls.RichTextBoxUI.Dialogs.ImageEditorDialog.ShowDialog(Inline selectedImage, Action`2 replaceCurrentImageCallback, String executeToolName, RadRichTextBox owner)
   at Telerik.Windows.Controls.RadRichTextBox.ShowImageEditorDialog(String executeToolName)
   at Telerik.Windows.Controls.RichTextBoxUI.ImageMiniToolBar.ExecuteShowImageEditor(Object param)
   at Telerik.Windows.Controls.DelegateCommand.Execute(Object parameter)
   at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(ICommandSource commandSource, Boolean userInitiated)
   at System.Windows.Controls.Primitives.ButtonBase.OnClick()
   at System.Windows.Controls.Button.OnClick()
   at Telerik.Windows.Controls.RadButton.OnClick()
   at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
   at System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e)
   at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
   at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
   at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
   at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
   at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at System.Windows.Application.Run(Window window)
   at System.Windows.Application.Run()

...

Dinko | Tech Support Engineer
Telerik team
 answered on 23 Jul 2020
2 answers
514 views

I am trying to change a CornerRadius value with StaticResource but there is an error showing.

My goal is to override CornerRadius of my controls. For instance, a RadComboBox. I already have the Style RadComboBoxStyle which have the following Setter value.

<Setter Property="mat:MaterialAssist.CornerRadius" Value="{telerik:FluentResource ResourceKey=CornerRadius}"/>

 

When I input numeric value (5, 10) as Value, I works well. But I want to have a StaticResource that holds the numeric value so I created a System:Double resource that holds the cornerradius value but when I put it as Value in the Style Setter, an error is showing. 

 

My code 

<Setter Property="mat:MaterialAssist.CornerRadius" Value="{StaticResource GenericInputCornerRadius}"/>

Error

''5' is not a valid value for property 'CornerRadius'.'

Dinko | Tech Support Engineer
Telerik team
 answered on 23 Jul 2020
1 answer
190 views

When the RadLinearSparline is in AutoRange, is there a way to get the actual Y Axis Min Range and Max Range values? These values would then be displayed in a separate control.   I have bound the MinYValue and MaxYValue to properties and am able to get the values when AutoRange = false but when AutoRange = true the MinYValue and MaxY are always 0.

<telerik:RadLinearSparkline  Grid.Row="0" Grid.RowSpan="3" Grid.Column="1"
                                       ItemsSource="{Binding AsyncData, Converter={StaticResource collectionConverter}}"
                                                                
                                       YValuePath="YVal"
                                       LineStroke="{Binding FontColor}"
                                       ShowNormalRange="True"
                                       AutoRange="{Binding AutoRange}"
                                       MinYValue="{Binding MinYvalue}"
                                       MaxYValue="{Binding MaxYvalue}"
                                       NormalRangeTop="{Binding Maximum}"
                                       NormalRangeBottom="{Binding Minimum}"
                                       EmptyPointBehavior="DropPoint"
                                                                >

 

 

Vladimir Stoyanov
Telerik team
 answered on 22 Jul 2020
1 answer
102 views

Hi,

I'm using WmsTiledProvider. My problem is that the format value sent is PNG and I cannot change it. How can I solve this problem.








 

 

Vladimir Stoyanov
Telerik team
 answered on 22 Jul 2020
1 answer
216 views

Hello

I want to buy DevCraft Complete, I want to be confirmed that I can use RadWebCam with digital camera instead of web cam, my application  senario is as following:

I want to connect the digital camera to the PC (sony or canon digital camera) then when I open the window that has RadWebCam conrol, the user can capture the photo from the digital camera instead of capture the photo from the camera it self (using the capture button on the camera)

Is this possible with WebCam control?

Thanks

Abdulsalam

Ivan Petrov
Telerik team
 answered on 21 Jul 2020
0 answers
122 views

in attached screenshot, I need to make all rows expanded always, so that I can select only radio button at a time. as of I now if I select a row and collapse it, it allows to choose another value from expanded rows. which cause application to crash, I need to keep only one selected radio button value from all available rows.

code for radio button below:

 

<StackPanel Orientation="Horizontal">
                                                <RadioButton                                                  
                                                    Margin="0,0,10,0"
                                                    VerticalAlignment="Center"
                                                    GroupName="IndexedValue"
                                                    IsChecked="{Binding IsIndexedValue}" ToolTip="Select Only 1 value for indexing">
                                                    <RadioButton.Visibility>
                                                        <Binding                                                           
                                                            Converter="{StaticResource IsIndexedValueSelectedToVisibilityConverter}"
                                                            Path="DataContext.IsIndexedValueSelected" 
                                                            Source="{x:Reference ParameterValueListView}"/>
                                                    </RadioButton.Visibility>
                                                </RadioButton>

yogeshwar
Top achievements
Rank 1
 asked on 21 Jul 2020
1 answer
121 views

I am trying to use DataPager on my grid. My goal is to put the pager on the different part of my screen.

For example, I have a window with two main grid. I used a Frame on the first grid to display a page with RadGridView. This Grid is the one I want to have the Pager. But I want to put the Pager on the second Grid of my main window. This is for layout purpose. Is this possible? 

 

Thank you

Martin Ivanov
Telerik team
 answered on 21 Jul 2020
1 answer
173 views
I've got DropBox installed on Windows.  When I look at Windows Explorer, I see it as a top-level node, alongside "This PC" and "Quick Access"

Is there any way to incorporate this into the Telerik File/Folder dialogs and RadPathPicker?
Dilyan Traykov
Telerik team
 answered on 20 Jul 2020
2 answers
102 views

Hello.  I have a RadGridView with a large collection of items (4000 columns, up to 400 rows), which are grouped together (4 columns in each group).  Currently, we're generating the columns and groups in the codebehind, but it takes a long time to generate the table since we're creating every column and group object, even if they're not currently shown.

We end up with a table that looks similar to the (completely fake) attached image - 4 columns of statistics for each item in the header.

 

I'd like to try autogenerating the columns and groups, using virtualization so we don't have to create the view objects for every column and group unless they're needed.  However, I don't know how to autogenerate the groups.  Is there a way to do so in the xaml?  Or, is the solution to autogenerate the columns, but add the groups programatically as the columns are generated?

I haven't attached any dummy data, since I expect the data has to be organized in a specific manner to get this to work.

 

Thanks in advance for any help you can provide.

Vladimir Stoyanov
Telerik team
 answered on 20 Jul 2020
0 answers
3.0K+ views

Hello,

I have a new issue. I'd like to change and update the display name of a property at run-time.

The scenario is that if we want to change the name of a property (for example, LinkBudgetApp1 with "App1" as display name),

we do the changes in the project settings, so the current display is overwritten. So far, I did the appropriate changes in the code 3.

However, nothing changes.

Maybe I'm using ICustomTypeDescriptor and PropertyDescriptor in the wrong way, please tell me what are the changes to do to make

this work. Thank you.

 

A sample model class

public class LinkBudgetExpandableAttribute : ObservableObjectBase
    {
 
        // Constructor here
 
        // Implementation of ObservableObjectBase
 
  
        [DisplayName("App1")]
        public string LinkBudgetApp1
        {
            get { // some code here }
            set { // some code here }
        }
 
        [[DisplayName("App2")]
        public string LinkBudgetApp2
        {
            get { // some code here }
            set { // some code here }
        }
 
        [DisplayName("App3")]
        public string LinkBudgetApp3
        {
            get { // some code here }
            set { // some code here }
        }
 
        public override string ToString()
        {
            // returns all properties values
        }
}

 

Implementation of ICustomTypeDescriptor

class LinkBudgetToPropertyGridAdapter : ICustomTypeDescriptor
    {
        public readonly LinkBudgetExpandableAttribute lbe;
        Dictionary<string, IEnumerable<Attribute>> dctPropertyConfiguration = new Dictionary<string, IEnumerable<Attribute>>();
         
        public LinkBudgetToPropertyGridAdapter(object feature, Dictionary<string, IEnumerable<Attribute>> attributes)
        {
            this.lbe = feature as LinkBudgetExpandableAttribute;
            this.dctPropertyConfiguration = attributes;
        }
 
        public object GetValue()
        {
            return lbe;
        }
 
        public AttributeCollection GetAttributes()
        {
            return TypeDescriptor.GetAttributes(lbe, true);
        }
 
        public string GetClassName()
        {
            return GetType().Name;
        }
 
        public string GetComponentName()
        {
            throw new NotImplementedException();
        }
 
        public TypeConverter GetConverter()
        {
            return TypeDescriptor.GetConverter(lbe, true);
        }
 
        public EventDescriptor GetDefaultEvent()
        {
            return TypeDescriptor.GetDefaultEvent(lbe, true);
        }
 
        public PropertyDescriptor GetDefaultProperty()
        {
            return TypeDescriptor.GetDefaultProperty(lbe, true);
        }
 
        public object GetEditor(Type editorBaseType)
        {
            return TypeDescriptor.GetEditor(lbe, editorBaseType, true);
        }
 
        public EventDescriptorCollection GetEvents()
        {
            return TypeDescriptor.GetEvents(lbe, true);
        }
 
        public EventDescriptorCollection GetEvents(Attribute[] attributes)
        {
            return TypeDescriptor.GetEvents(lbe, attributes, true);
        }
 
        public PropertyDescriptorCollection GetProperties()
        {
            return GetProperties(new Attribute[0]);
        }
 
        public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
        {
            List<PropertyDescriptor> props = new List<PropertyDescriptor>();
            string[] linkBudgetAttributeNames =
                {FeatureAttributes.LinkBudgetInput,
                FeatureAttributes.LinkBudgetInputApp1,
                FeatureAttributes.LinkBudgetInputApp2,
                FeatureAttributes.LinkBudgetInputApp3
            };
             
            foreach (var attributeName in linkBudgetAttributeNames)
            {
                if (dctPropertyConfiguration.Keys.Contains(attributeName))
                {
                    var prop = new LinkBudgetDescriptor(attributeName, lbe, dctPropertyConfiguration[attributeName]);
                    props.Add(prop);
                }
            }
            return new PropertyDescriptorCollection(props.ToArray());
        }
 
        public object GetPropertyOwner(PropertyDescriptor pd)
        {
            return this;
        }
    }

 

A method to define and retrieve attributes in some class

protected virtual Project GetCurrentProject { get; }
 
protected Dictionary<string, IEnumerable<Attribute>> getAttributeConfiguration()
        {
            Dictionary<string, IEnumerable<Attribute>> result = new Dictionary<string, IEnumerable<Attribute>>();
 
            foreach (var fa in FeatureAttributes.StandardFeatureAttributes)
            {
                var attributes = new List<Attribute>();
                attributes.Add(new CategoryAttribute(fa.Category));
                attributes.Add(new DisplayNameAttribute(fa.DisplayName));
                attributes.Add(new DescriptionAttribute(fa.Description));
                attributes.Add(new ReadOnlyAttribute(fa.IsReadOnly));
                if (fa.Converter != null)
                {
                    attributes.Add(new TypeConverterAttribute(fa.Converter));
                }
                attributes.Add(new BrowsableAttribute(fa.IsBrowsable));
                 
 
                /// *** HACK *** Telerik uses a DisplayAttribute instead of a DisplayNameAttribute to define the name displayed
                var displayAttribute = new DisplayAttribute();
                if (fa.Name.Contains("App1"))
                {
                    displayAttribute.Name = GetCurrentProject.Settings.Applications["Application1"].Name;
                    displayAttribute.AutoGenerateField = true;
                
                else if (fa.Name.Contains("App2"))
                {
                    displayAttribute.Name = GetCurrentProject.Settings.Applications["Application2"].Name;
                    displayAttribute.AutoGenerateField = GetCurrentProject.Settings.Applications["Application2"].IsVisible;
                }
                else if (fa.Name.Contains("App3"))
                {
                    displayAttribute.Name = GetCurrentProject.Settings.Applications["Application3"].Name;
                    displayAttribute.AutoGenerateField = GetCurrentProject.Settings.Applications["Application3"].IsVisible;
                }
                else
                    displayAttribute.Name = fa.DisplayName;
                displayAttribute.GroupName = fa.Category;
                displayAttribute.Description = fa.Description;
                 
                attributes.Add(displayAttribute);
 
                result.Add(fa.Name, attributes);
            }
 
            return result;
        }

Implementation of PropertyDescriptor

public class LinkBudgetDescriptor : PropertyDescriptor
    {
        private readonly List<Attribute> PropertyAttributes;
        private readonly LinkBudgetExpandableAttribute lbe;
        public LinkBudgetDescriptor(string attributeName, LinkBudgetExpandableAttribute lbe,
            IEnumerable<Attribute> dctPropertyConfiguration)
            : base(attributeName, dctPropertyConfiguration.ToArray())
        {
            this.lbe = lbe;
            PropertyAttributes = dctPropertyConfiguration.ToList();
        }
        public override AttributeCollection Attributes
        {
            get
            {
                return base.Attributes;
            }
        }
        public override string Category { get { return PropertyAttributes.OfType<CategoryAttribute>().SingleOrDefault()?.Category; } }
        public override string Description { get { return PropertyAttributes.OfType<DescriptionAttribute>().SingleOrDefault()?.Description; } }
        public override string DisplayName { get { return PropertyAttributes.OfType<DisplayNameAttribute>().SingleOrDefault()?.DisplayName; } }
        public override bool IsReadOnly { get { return PropertyAttributes.OfType<ReadOnlyAttribute>().SingleOrDefault() != null ? PropertyAttributes.OfType<ReadOnlyAttribute>().SingleOrDefault().IsReadOnly : false; } }
        public override Type ComponentType { get { return typeof(LinkBudgetToPropertyGridAdapter); } }
        public override Type PropertyType
        {
            get
            {
                var val = lbe.GetType();
                return val;
            }
        }
    
        public override bool CanResetValue(object component)
        {
            return true;
        }
        public override object GetValue(object component)
        {
            return (component as LinkBudgetToPropertyGridAdapter).GetValue();
        }
        public override void ResetValue(object component)
        {
            
        }
        public override void SetValue(object component, object value)
        {
           
        }
        public override bool ShouldSerializeValue(object component)
        {
            return false;
        }
    }
Yefan
Top achievements
Rank 1
Veteran
 asked on 20 Jul 2020
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?