Telerik Forums
UI for WPF Forum
1 answer
89 views
Hi,

I am trying to draw a sequare using the MapRectangle control.The sample I found at this post (http://www.telerik.com/community/forums/wpf/map/draw-square.aspx) is throwing exception at the highlighted line:

private void SetShapeParameters()
        {
            if (this.MapControl != null)
            {
                Rectangle rect = this.Shape as Rectangle;
 
                Size size = this.MapCanvas.GetPixelSize(this.Location, this.RadiusX, this.RadiusY);
                if (!double.IsNaN(size.Width) && !double.IsInfinity(size.Width))
                {
                    rect.RadiusX = size.Width;
                }
 
                if (!double.IsNaN(size.Height) && !double.IsInfinity(size.Height))
                {
                    rect.RadiusY = size.Height;
                }
            }
        }

The exception is "Object reference not set to an instance of an object" and it is because this.MapCanvas is null.

Any help will be highly appreciated.

Madani
Andrey
Telerik team
 answered on 23 Dec 2011
4 answers
311 views

This is quite hard to reproduce, but by clicking around on the column headers to group and sort them quickly enough I can generate an exception similar to this:

System.ArgumentOutOfRangeException was unhandled
  Message=Index must be within the bounds of the List.
Parameter name: index
  Source=mscorlib
  ParamName=index
  StackTrace:
       at System.Collections.ObjectModel.Collection`1.Insert(Int32 index, T item)
       at Telerik.Windows.Controls.GridView.GridViewDataControl.PerformGrouping(IGroupDescriptor descriptor, Nullable`1 insertionIndex, GroupingEventAction action)
       at Telerik.Windows.Controls.GridView.GridViewDataControl.<>c__DisplayClass36.<RequestGrouping>b__35()
       at Telerik.Windows.Controls.CursorManager.PerformTimeConsumingOperation(FrameworkElement frameworkElement, Action action)
       at Telerik.Windows.Controls.GridView.GridViewDataControl.RequestGrouping(IGroupDescriptor descriptor, Nullable`1 insertionIndex, GroupingEventAction action)
       at Telerik.Windows.Controls.GridView.DragDropController.OnGroupPanelDropInfo(Object sender, DragDropEventArgs e)
       at Telerik.Windows.Controls.DragDrop.DragDropEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
       at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
       at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
       at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
       at Telerik.Windows.Controls.DragDrop.RadDragAndDropManager.DragDropProvider_DropInfo(Object sender, DragDropEventArgs e)
       at Telerik.Windows.Controls.DragDrop.DragDropProviderBase.RaiseDropInfo()
       at Telerik.Windows.Controls.DragDrop.SimulatedDragDropProvider.OnDrop()
       at Telerik.Windows.Controls.DragDrop.SimulatedDragDropProvider.OnCoverRectangleMouseLeftButtonUpInternal()
       at Telerik.Windows.Controls.DragDrop.SimulatedDragDropProvider.OnCoverRectangleMouseLeftButtonUp(Object sender, EventArgs e)
       at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
       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.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
       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.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 MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.InvokeImpl(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.Application.RunInternal(Window window)
       at System.Windows.Application.Run()
       at Crash_Example.App.Main() in c:\users\matthewb\documents\visual studio 2010\Projects\Crash_Example\obj\Debug\App.g.cs:line 0
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException:

I've made a small example project with a simple grid and can reproduce it there as well
(I can't see how I can attach it to this thread?)

The grid simply has 5 columns and 5000 rows

All I do is rapidly drag any column header into the grouping bar, remove it and change the sorting on it by clicking round like a mad man! It's quite random and sometimes takes as much as a minute to reproduce

Here's the XAML in case it helps:

<Window x:Class="Crash_Example.MainWindow"
        xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
        Title="Crash Example" Height="350" Width="525">
   <telerik:RadGridView x:Name="TheGrid"
                        Style="{StaticResource CrashGrid}">
      <telerik:RadGridView.Columns>
 
         <telerik:GridViewComboBoxColumn DataMemberBinding="{Binding A}"
                                          UniqueName="A"
                                          Header="A"
                                          DisplayMemberPath="Data"
                                          SelectedValueMemberPath="Id"
                                          ItemsSourceBinding="{Binding Converter={StaticResource converter}, ConverterParameter=A, Mode=OneWay}" />
 
         <telerik:GridViewComboBoxColumn DataMemberBinding="{Binding B}"
                                          UniqueName="B"
                                          Header="B"
                                          DisplayMemberPath="Data"
                                          SelectedValueMemberPath="Id"
                                          ItemsSourceBinding="{Binding Converter={StaticResource converter}, ConverterParameter=B, Mode=OneWay}" />
 
         <telerik:GridViewColumn UniqueName="Arrow"
                                 Style="{StaticResource ArrowColumn}" />
 
         <telerik:GridViewDataColumn UniqueName="C" Header="C">
            <telerik:GridViewDataColumn.CellEditTemplate>
               <DataTemplate>
                  <TextBox Text="{Binding C}"
                           MaxLength="20" />
               </DataTemplate>
            </telerik:GridViewDataColumn.CellEditTemplate>
         </telerik:GridViewDataColumn>
             
         <telerik:GridViewDataColumn UniqueName="D" Header="D">
            <telerik:GridViewDataColumn.CellEditTemplate>
               <DataTemplate>
                  <TextBox Text="{Binding D}"
                           MaxLength="20" />
               </DataTemplate>
            </telerik:GridViewDataColumn.CellEditTemplate>
         </telerik:GridViewDataColumn>
 
      </telerik:RadGridView.Columns>
   </telerik:RadGridView>
</Window>

<Application x:Class="Crash_Example.App"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView" xmlns:Crash_Example="clr-namespace:Crash_Example" StartupUri="MainWindow.xaml">
   <Application.Resources>
      <ResourceDictionary>
         <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary>
                
               <Crash_Example:Converter x:Key="converter" />
 
               <Style x:Key="CrashGrid" TargetType="telerik:RadGridView">
                  <Setter Property="AutoGenerateColumns"        Value="False" />
                  <Setter Property="BorderThickness"            Value="0" />
                  <Setter Property="CanUserInsertRows"          Value="True" />
                  <Setter Property="CanUserReorderColumns"      Value="False" />
                  <Setter Property="ClipboardPasteMode"         Value="Cells" />
                  <Setter Property="DataLoadMode"               Value="Asynchronous" />
                  <Setter Property="EditTriggers"               Value="CellClick" />
                  <Setter Property="EnableColumnVirtualization" Value="True" />
                  <Setter Property="EnableRowVirtualization"    Value="True" />
                  <Setter Property="IsFilteringAllowed"         Value="False" />
                  <Setter Property="ItemsSource"                Value="{Binding Path=Data}" />
                  <Setter Property="SelectionMode"              Value="Extended" />
                  <Setter Property="ShowInsertRow"              Value="False" />
               </Style>
 
               <Style x:Key="ArrowColumn" TargetType="telerik:GridViewColumn">
                  <Setter Property="Background"   Value="#FF727272" />
                  <Setter Property="IsEnabled"    Value="False" />
                  <Setter Property="IsFilterable" Value="False" />
                  <Setter Property="IsGroupable"  Value="False" />
                  <Setter Property="IsReadOnly"   Value="True" />
                  <Setter Property="IsResizable"  Value="False" />
                  <Setter Property="IsSortable"   Value="False" />
                  <Setter Property="IsVisible"    Value="True" />
                  <Setter Property="Width"        Value="30" />
                  <Setter Property="CellTemplate">
                     <Setter.Value>
                        <DataTemplate>
                           <TextBlock Background="Transparent"
                                            Foreground="WhiteSmoke"
                                            FontWeight="Bold"
                                            FontFamily="Arial Unicode MS"
                                            HorizontalAlignment="Center">
                              âž¨
                           </TextBlock>
                        </DataTemplate>
                     </Setter.Value>
                  </Setter>
               </Style>
 
            </ResourceDictionary>
         </ResourceDictionary.MergedDictionaries>
      </ResourceDictionary>
   </Application.Resources>
</Application>

If anyone has any suggestions as to how I can improve the scrolling speed as well I'd be very grateful!
Stanislav
Top achievements
Rank 1
 answered on 23 Dec 2011
5 answers
176 views
I updated my dlls to Q2 2011 from Q1 2011. My DialogParameters.Opened handler for RadWindow.Prompt/Alert/Confirm doesn't get fired after upgrading.

Also, I previously had a RadWindow.Alert that was passing in a StackPanel with a RadExpander. The RadExpander doesn't resize the window anymore, like it used to...it just expands down below the visible area of my alert window.
const string message = "We're sorry, an error has occurred. Please report this to your support representative.";
var errorTextBox = new TextBox
{
    IsReadOnly = true,
    Text = exception.ToString(),
    TextWrapping = TextWrapping.Wrap,
    TextAlignment = TextAlignment.Left,
    VerticalContentAlignment = VerticalAlignment.Top,
    MaxWidth = 360,
    Height = 150
};
 
errorTextBox.MouseDoubleClick += delegate { errorTextBox.SelectAll(); };
 
var panel = new StackPanel();
panel.Children.Add(new TextBlock { Text = message, Padding = new Thickness(0, 0, 0, 12), TextWrapping = TextWrapping.Wrap });
panel.Children.Add(new RadExpander { Content = errorTextBox, Header = "Details..." });
var dialogParameters = new DialogParameters
{
    Owner = owner,
    Header = "An error has occurred",
    Content = new ContentControl { MaxWidth = 400, MinHeight = 80, Content = panel },
    Opened = (sender, e) => ((ContentControl)sender).Focus()
};
 
RadWindow.Alert(dialogParameters);

Why have all these things stopped working? I upgraded to Q2 from Q1 because of a different bug in the lazy loading of a RadTreeView...but now I guess I need to go back to Q1?
George
Telerik team
 answered on 23 Dec 2011
1 answer
107 views
We're new to these controls and we are trying to figure out whether we can have controls within a tile.  For example, can I put buttons, combo-boxes in a tile?  Can I launch an overlay from within a tile?
Thanks!
Tina Stancheva
Telerik team
 answered on 23 Dec 2011
1 answer
192 views
HI 
we are trying to build wpf app it has dockable interface we are using Teleriks RadDockPane, In Document host we want the horizontal splitter like visual studio
for example: switch between XAML and Design, swapping two panels like same as visualstudio please see the attached image we want same like that control.
 to achieve this goal already Telerik have any set of controls or else  how can we acheive this please guide us...thanks
George
Telerik team
 answered on 23 Dec 2011
1 answer
250 views
I have a raddatetimepicker in my application. When I open the pop-up it will show the days of the months.. and the last days of the last month and the first days of the next month.

Lets say that the date already selected i 24th november 2011. When I open the pop-up, I can select the 2nd december without changing the month. That works.. but if I double-click on the 2nd december, it chooses 30th december, not 2nd.

I have implemented the mousedoubleclick event:

  void RadDateTimePicker_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            if (((RadDateTimePicker)sender).IsDropDownOpen)
                ((RadDateTimePicker)sender).IsDropDownOpen = false;
            else if (((RadDateTimePicker)sender).SelectedValue == null)
                ((RadDateTimePicker)sender).SelectedValue = DateTime.Now;
            e.Handled = true;
        }

The selected value is the 30th december, not the 2nd december in the mousedoubleclick-handler.

It there any way to make sure that a doubleclick selects the intended date (and closes the pop-up-dialog)?

This error only appears when the popup dialog shows a specific month and I click on the "grey-out" dates in the surounding months.

Yana
Telerik team
 answered on 23 Dec 2011
0 answers
82 views
The documentation on MSDN says about CancelEdit:

CancelEdit sets CurrentEditItem to null and causes the collection view to exit the edit state. If CanCancelEdit is true, CancelEdit also restores the original values of the edited object.

This means: first set CurrentEditItem to null, then if possible restore original values. The implementation in QueryableCollectionView.Editing.cs is slightly different because CurrentEditItem is only set to null if it is an IEditableObject otherwise it throws an exception. In my opinion this is not correct. Of course CancelEdit should only be called on the CurrentEditItem if it is an IEditableObject, but setting CurrentEditItem to null should always be called! So the corrected code must be:

if (this.CanCancelEdit)
{
   CancelEditItem(this.CurrentEditItem);
}
this.CurrentEditItem = null;

Heiko
Top achievements
Rank 1
Iron
Veteran
 asked on 23 Dec 2011
1 answer
153 views
Hi I'm trying to serialize the RadRichTextBox control but I get the following error: "ambiguous match found."
this is my code

Canvas
cvs = new Canvas();
RadRichTextBox rch = new RadRichTextBox();

rch.Width = 100;

rch.Height = 100;

cvs.Children.Add(rch);

string str = System.Windows.Markup.XamlWriter.Save(cvs);


regards
Nicola De Stefano
Iva Toteva
Telerik team
 answered on 23 Dec 2011
1 answer
150 views
Dear Support,

using the RadGridView inside a DataTemplate, the bound SelectedItem becomes null in the first VM
after changing the VM to a second, different, VM of the same type.

  <ContentPresenter Content="{Binding CurrentContentViewModel}">
            <ContentPresenter.Resources>
                <ResourceDictionary>
                    <DataTemplate DataType="{x:Type local:ContentViewModel}">
                        <telerik:RadGridView ItemsSource="{Binding Items}"
                                             SelectedItem="{Binding SelectedItem}" />
                        <!--<ListView ItemsSource="{Binding Items}"
                                  SelectedItem="{Binding SelectedItem}" />-->
                    </DataTemplate>
                </ResourceDictionary>
            </ContentPresenter.Resources>
        </ContentPresenter>

Alternatively i tried ListView, which behaves as expected.

Is this a bug or am I doing wrong?

Find here a solution that reproduces this behaviour.

TestRadGridViewSelectedItem.zip

Version is: 2011.3.1116.40 / Runtime is v4.0.30319

Thanks Martin
Nedyalko Nikolov
Telerik team
 answered on 23 Dec 2011
5 answers
1.3K+ views
Hi there

Could anyone please tell me how can I enable my RichTextBoxRibbonUI to insert an image using an absolute URL as the source.

Instead of the OpenFileDialog, I want to type http://www.host.com/images/image.jpg

I saw this post here:
http://www.telerik.com/community/forums/silverlight/richtextbox/inserting-an-image-in-the-radrichtextbox.aspx

But sitll have no idea how to implement it, on both xaml and .cs sides.

Thanks

Emerson de Mello
Iva Toteva
Telerik team
 answered on 22 Dec 2011
Narrow your results
Selected tags
Tags
GridView
General Discussions
Chart
RichTextBox
Docking
ScheduleView
ChartView
TreeView
Diagram
Map
ComboBox
TreeListView
Window
RibbonView and RibbonWindow
PropertyGrid
DragAndDrop
TabControl
TileView
Carousel
DataForm
PDFViewer
MaskedInput (Numeric, DateTime, Text, Currency)
AutoCompleteBox
DatePicker
Buttons
ListBox
GanttView
PivotGrid
Spreadsheet
Gauges
NumericUpDown
PanelBar
DateTimePicker
DataFilter
Menu
ContextMenu
TimeLine
Calendar
Installer and Visual Studio Extensions
ImageEditor
BusyIndicator
Expander
Slider
TileList
PersistenceFramework
DataPager
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
WatermarkTextBox
DesktopAlert
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
LayoutControl
ProgressBar
Sparkline
TabbedWindow
ToolTip
CloudUpload
ColorEditor
TreeMap and PivotMap
EntityFrameworkCoreDataSource (.Net Core)
HeatMap
Chat (Conversational UI)
VirtualizingWrapPanel
Calculator
NotifyIcon
TaskBoard
TimeSpanPicker
BulletGraph
Licensing
WebCam
CardView
DataBar
FilePathPicker
PasswordBox
SplashScreen
Callout
Rating
Accessibility
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?