Telerik Forums
UI for WPF Forum
4 answers
701 views
Hello,

I have a RadTreeView using a templated ItemsSource bound to a node collection in the view model.  I have implemented a search on the tree, and the found node is programmatically selected within the view model (there is no code in the view).  Do you have an example of how to bring the selected node into view using this type of MVVM structure?

Thanks for any help.
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
 answered on 23 Dec 2011
0 answers
172 views
I'm drawing polyline objects, and when plotted I'm making them draggable. How can I get the coordinates for each point of the polyline after it's been dragged to a different location on the map?

Update: Figured it out (doh!):

 MapPolygon thePolygon = item as MapPolygon;
                if (thePolygon != null)
                {
                    int pointCount = thePolygon.Points.Count - 1;
                    Debug.WriteLine("Number of Points: "+ pointCount);
                }

                Location[] locArray = thePolygon.Points.ToArray();

                foreach(Location loc in locArray)
                {
                    Debug.WriteLine("" + loc.Latitude.ToString());
                    Debug.WriteLine("" + loc.Longitude.ToString());
                }
ejb
Top achievements
Rank 2
 asked on 23 Dec 2011
2 answers
94 views
I noticed that if the RibbonView background is set then the window buttons do not show.
Datafyer
Top achievements
Rank 1
Veteran
 answered on 23 Dec 2011
1 answer
62 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
297 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
166 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
95 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
174 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
219 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
75 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
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?