Telerik Forums
UI for WPF Forum
3 answers
153 views
I'm trying to create a DataForm that uses a RichTextBox as one of the entry fields. My problem comes in when I try to programmatically set the binding of the RichTextBox. Here's what I have:

private void editCabinetForm_AutoGeneratingField(object sender, Telerik.Windows.Controls.Data.DataForm.AutoGeneratingFieldEventArgs e)
        {
            if (e.PropertyName == "CabinetName")
            {
                e.DataField.Label = "Cabinet Name";
            }
            else if (e.PropertyName == "BriefDescription")
            {
                e.DataField.Label = "Brief Description";
            }
            else if (e.PropertyName == "Comments")
            {
                RadRichTextBox commentsBox = new RadRichTextBox();
                //commentsBox.SetBinding(???, new Binding("Comments"));
                e.DataField.Content = commentsBox;
                e.DataField.Label = "Comments";
            }
            else
            {
                e.Cancel = true;
            }
        }

(Comments is a string variable)

I'm not quite sure what to use for the dependency property - any suggestions?
Vanya Pavlova
Telerik team
 answered on 26 Dec 2011
0 answers
101 views
hi all
i update my dataset . when i exit app and start again my new data is there but when i open database i see new data dont apply.
this is my code :

dBVideoArchiveDataSetArchiveTableTableAdapter.Update(dBVideoArchiveDataSet.ArchiveTable);

 

dBVideoArchiveDataSet.AcceptChanges();

 

radGridView1.Rebind();


thankful.
rastin
Top achievements
Rank 1
 asked on 26 Dec 2011
3 answers
162 views
Hi
     I am currenty developing WPF applications which will consume a wcf data service with works with entity framework 4.1 code first . In WPF application I am using Radgridview and RadDataServiceDataSource

   following the code in XAML page
 
              <telerik:RadDataServiceDataSource Height="100" HorizontalAlignment="Left" Margin="208,242,0,0" Name="radDataServiceDataSource1" VerticalAlignment="Top" Width="100" QueryName="Currency" AutoLoad="True" SubmittingChanges="radDataServiceDataSource1_SubmittingChanges">
            <telerik:RadDataServiceDataSource.DataServiceContext >
                <local:MyBaazaarContext/>
            </telerik:RadDataServiceDataSource.DataServiceContext>
        </telerik:RadDataServiceDataSource>
        <telerik:RadGridView Grid.Row="0" ItemsSource="{Binding DataView, ElementName=radDataServiceDataSource1}" IsBusy="{Binding IsBusy, ElementName=radDataServiceDataSource1}" ShowGroupPanel="False" Name="grdDetails"  />
 
When I am making changes in the gridview an calling   radDataServiceDataSource1.SubmitChanges() nothings getting change.


please Help

Thanks In Advance
Rossen Hristov
Telerik team
 answered on 26 Dec 2011
0 answers
96 views
hi there,

in row_loaded method, we create a multibinding for background. converter is not called in first run.

-populate table (set binding in row_loaded)

-set background on viewmodel

-converter not called.

-clear table

-populate table (again create binding)

-set background, then it is called.

While in debug, when I checked PropertChanged.Target, in first run it is System.ComponentModel.PropertyChangedEventManager  (doesnt work),
and in the second run, it is Telerik.Windows.Data.WeakEvent.WeakListener<System.ComponentModel.PropertyChangedEventArgs>.


Telerik version : 2011.1.411.40


MultiBinding multiBindingBackground = new MultiBinding();
                        multiBindingBackground.Converter = cellColorConverter;
 
 
                        Binding background = new Binding("Background");
                        background.Source = row.Item;                       
                        background.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
                        //background.Mode = BindingMode.TwoWay;
                        multiBindingBackground.Bindings.Add(background);
                        multiBindingBackground.Bindings.Add(rcBinding);
                        Binding isBackgroundForBackground = new Binding();
                        isBackgroundForBackground.Source = true;
                        multiBindingBackground.Bindings.Add(isBackgroundForBackground);
                        multiBindingBackground.Bindings.Add(new Binding());
                        cellBase.SetBinding(GridViewCellBase.BackgroundProperty, multiBindingBackground);
CEM
Top achievements
Rank 1
 asked on 26 Dec 2011
4 answers
767 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
220 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
132 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
93 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
315 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
181 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
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
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?