HI all,
I have created a rad pane custom control in a class say
public class CustomControl:RadPane{}<DataTemplate x:Key="ObstructionPointItemTemplate" DataType="mapLayers:ObstructionPointViewModel"> <telerik:MapPinPoint telerik:MapLayer.Location="{Binding Path=Location}" ToolTip="{Binding Label}" > <i:Interaction.Behaviors> <behaviors:PointBehavior/> <!--This behavior allows the drap and drop move--> </i:Interaction.Behaviors> </telerik:MapPinPoint> </DataTemplate>
<DataTemplate x:Key="ObstructionPointItemTemplate" DataType="mapLayers:ObstructionPointViewModel"> <telerik:MapEllipse Width="0.1" Height="0.1" telerik:MapLayer.Location="{Binding Path=Location}" Fill="{StaticResource PointFill}" ToolTip="{Binding Label}" Stroke="{StaticResource ObstructionPointColor}" StrokeThickness="2" > </telerik:MapEllipse> </DataTemplate>
var radDocument = RadDocumentHelper.GetDefaultDocument(); foreach (var item in ClausesSelectedList) { radDocument = item.ClauseData.GetRadDocument(FieldOrderNumber, RevNumber.Value); var section = new Section(); var frag = new DocumentFragment(radDocument); var docPos1 = new DocumentPosition(radDocument); docPos1.MoveToLastPositionInDocument(); radDocument.InsertFragment(frag, docPos1); }
at Telerik.Windows.Documents.Model.Table.RecalculateRowHeights(TableLayoutBox tableBox, Boolean shouldMeasureCells) in c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Documents\Core\Model\Table.cs:line 960
at Telerik.Windows.Documents.Layout.TableLayoutBox.MeasureOverride(SizeF availableSize) in c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Documents\Core\Layout\TableLayoutBox.cs:line 278
at Telerik.Windows.Documents.Layout.LayoutElement.MeasureCore(SizeF availableSize) in c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Documents\Core\Layout\LayoutElement.cs:line 929
at Telerik.Windows.Documents.Layout.LayoutElement.Measure(SizeF availableSize) in c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Documents\Core\Layout\LayoutElement.cs:line 832
at Telerik.Windows.Documents.Layout.SectionLayoutBox.MeasureOverrideInternal(SizeF availableSize) in c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Documents\Core\Layout\SectionLayoutBox.cs:line 473
at Telerik.Windows.Documents.Layout.SectionLayoutBox.MeasureOverride(SizeF availableSize) in c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Documents\Core\Layout\SectionLayoutBox.cs:line 277
at Telerik.Windows.Documents.Layout.LayoutElement.MeasureCore(SizeF availableSize) in c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Documents\Core\Layout\LayoutElement.cs:line 929
at Telerik.Windows.Documents.Layout.LayoutElement.Measure(SizeF availableSize) in c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Documents\Core\Layout\LayoutElement.cs:line 832
at Telerik.Windows.Documents.Layout.DocumentLayoutBox.MeasureOverrideInternal(SizeF availableSize) in c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Documents\Core\Layout\DocumentLayoutBox.cs:line 184
at Telerik.Windows.Documents.Layout.DocumentLayoutBox.MeasureOverride(SizeF availableSize) in c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Documents\Core\Layout\DocumentLayoutBox.cs:line 138
at Telerik.Windows.Documents.Layout.LayoutElement.MeasureCore(SizeF availableSize) in c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Documents\Core\Layout\LayoutElement.cs:line 929
at Telerik.Windows.Documents.Layout.LayoutElement.Measure(SizeF availableSize) in c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Documents\Core\Layout\LayoutElement.cs:line 832
at Telerik.Windows.Documents.Model.RadDocument.Measure(SizeF measureSize) in c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Documents\Core\Model\RadDocument.cs:line 1197
at Telerik.Windows.Documents.UI.DocumentPrintLayoutPresenter.MeasureOverride(Size availableSize) in c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Documents\Core\UI\DocumentPrintLayoutPresenter.cs:line 675
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.ContextLayoutManager.UpdateLayout()
at System.Windows.UIElement.UpdateLayout()
at Telerik.Windows.Documents.UI.DocumentPresenterBase.Telerik.Windows.Controls.IDocumentEditorPresenter.UpdateLayout()
at Telerik.Windows.Controls.RadRichTextBox.<>c__DisplayClass1e.<UpdateEditorLayout>b__1d() in c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Documents\Core\UI\RadRichTextBox.cs:line 3728
at Telerik.Windows.Controls.RadRichTextBox.UpdateEditorLayout(Boolean focusCarret, Boolean updateCaretSize, Boolean async) in c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Documents\Core\UI\RadRichTextBox.cs:line 3743
at Telerik.Windows.Controls.RadRichTextBox.UpdateEditorLayout(Boolean async) in c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Documents\Core\UI\RadRichTextBox.cs:line 3704
at Telerik.Windows.Controls.RadRichTextBox.UpdateEditorLayout() in c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Documents\Core\UI\RadRichTextBox.cs:line 3695
at Telerik.Windows.Controls.RadRichTextBox.document_LayoutModeChanged(Object sender, EventArgs e) in c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Documents\Core\UI\RadRichTextBox.cs:line 2312
at Telerik.Windows.Documents.Model.RadDocument.OnLayoutModeChanged() in c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Documents\Core\Model\RadDocument.cs:line 6681
at Telerik.Windows.Documents.Model.RadDocument.set_LayoutMode(DocumentLayoutMode value) in c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Documents\Core\Model\RadDocument.cs:line 265
at Telerik.Windows.Controls.RadRichTextBox.SynchDocumentMiscProperties() in c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Documents\Core\UI\RadRichTextBox.cs:line 2774
at Telerik.Windows.Controls.RadRichTextBox.set_Document(RadDocument value) in c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Documents\Core\UI\RadRichTextBox.cs:line 1262
at NBCU.SAFE.POC.DA.UI.Control.TelerikRadEditorControl.DocumentProperty_Changed(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e) in C:\TfsProj\MiG4\Architectural Prototype\Modules\NBCU.SAFE.POC.DA\NBCU.SAFE.POC.DA.UI\Control\TelerikRadEditorControl.xaml.cs:line 39
at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
at System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp)
at System.Windows.Data.BindingExpressionBase.Invalidate(Boolean isASubPropertyChange)
at System.Windows.Data.BindingExpression.TransferValue(Object newValue, Boolean isASubPropertyChange)
at System.Windows.Data.BindingExpression.ScheduleTransfer(Boolean isASubPropertyChange)
at MS.Internal.Data.ClrBindingWorker.NewValueAvailable(Boolean dependencySourcesChanged, Boolean initialValue, Boolean isASubPropertyChange)
at MS.Internal.Data.PropertyPathWorker.UpdateSourceValueState(Int32 k, ICollectionView collectionView, Object newValue, Boolean isASubPropertyChange)
at MS.Internal.Data.ClrBindingWorker.OnSourcePropertyChanged(Object o, String propName)
at MS.Internal.Data.PropertyPathWorker.System.Windows.IWeakEventListener.ReceiveWeakEvent(Type managerType, Object sender, EventArgs e)
at System.Windows.WeakEventManager.DeliverEventToList(Object sender, EventArgs args, ListenerList list)
at System.ComponentModel.PropertyChangedEventManager.OnPropertyChanged(Object sender, PropertyChangedEventArgs args)
at NBCU.SAFE.POC.DA.UI.ViewModel.ClauseMaintenanceViewModel.OnPropertyChanged(String propertyName) in C:\TfsProj\MiG4\Architectural Prototype\Modules\NBCU.SAFE.POC.DA\NBCU.SAFE.POC.DA.UI\ViewModel\ClauseMaintenanceViewModel.cs:line 106
at NBCU.SAFE.POC.DA.UI.ViewModel.ClauseMaintenanceViewModel.set_SelectedClauseItem(HierarchyViewModel value) in C:\TfsProj\MiG4\Architectural Prototype\Modules\NBCU.SAFE.POC.DA\NBCU.SAFE.POC.DA.UI\ViewModel\ClauseMaintenanceViewModelprivate RadDocument GetRadDocument(IEnumerable table) { StyleDefinition customTableStyle = new StyleDefinition("MyCustomTableStyle", StyleType.Table); //customTableStyle.SpanProperties.FontSize = _exhibitTableInfo.point_size; //customTableStyle.SpanProperties.FontFamily = new FontFamily(_exhibitTableInfo.typeface); //customTableStyle.SpanProperties.FontWeight = _exhibitTableInfo.col_bold_flag == "Y" ? FontWeights.Bold : FontWeights.Normal; customTableStyle.BasedOnName = RadDocumentDefaultStyles.DefaultTableGridStyleName; StyleDefinition firstRowStyle = new StyleDefinition(StyleType.Table); //firstRowStyle.SpanProperties.FontWeight = _exhibitTableInfo.hdr_bold_flag == "Y" ? FontWeights.Bold : FontWeights.Normal; //if (_exhibitTableInfo.hdr_underlined_flag == "Y") firstRowStyle.SpanProperties.UnderlineDecoration = UnderlineTypes.Line; customTableStyle.ConditionalTableStylesCollection.Add(ConditionalTableStyleTypes.FirstRow, firstRowStyle); var radDocument = RadDocumentHelper.GetDefaultDocument(); radDocument.StyleRepository.Add(customTableStyle); var radSection = new Section(); var radTable = new Table(); radTable.Style = customTableStyle; //radTable.Borders = new TableBorders(new Border(Convert.ToSingle(_exhibitTableInfo.cell_border_width), BorderStyle.Single, Colors.Black)); //var type = GetTypeOfIEnumerable(table); //if (type != null) // probably no records in table, so no data to add to table //{ // properties = type.GetProperties().ToDictionary<PropertyInfo, string>(i => i.Name); // radTable.Rows.Add(GetHeaderRow()); // foreach (var row in table) radTable.Rows.Add(GetDataRow(row)); //} radDocument.Sections.Add(radSection); radSection.Blocks.Add(new Table()); return radDocument; }
I am creating a drag and drop dashboard page and I need some assistance with the drag and drop from RadTreeView to Grid. My goal is to drag an item from the tree which is text base, and have it render a user control at the point of drop on the Grid.
I have been looking for an example of this with no luck and was hoping this is possible. If it is possible do you have an example project that demonstrates this?
<Grid Name="cDashboardGrid" Background="White">
</Grid>
Public Class TempInfo Public Property Timestamp As DateTime Public Property SensorIndex As Int32 Public Property Temperature As Single Public Sub New(ByVal adTimestamp As DateTime, ByVal aiSensorIndex As Int32, ByVal afTemperature As Single) Timestamp = adTimestamp SensorIndex = aiSensorIndex Temperature = afTemperature End SubEnd ClassClass MainWindow Private Sub MainWindow_Loaded(sender As Object, e As System.Windows.RoutedEventArgs) Handles Me.Loaded Dim infos As New List(Of TempInfo) Dim loRandom As New Random For liDateCounter As Int32 = 1 To 10000 For liSensorCounter As Int32 = 1 To 12 infos.Add(New TempInfo(DateTime.Now.AddHours(liDateCounter), liSensorCounter, loRandom.Next(70, 90))) Next Next RadHeatMap1.Definition.ItemsSource = infos End SubEnd Class<Window x:Class="MainWindow" Title="MainWindow" Height="350" Width="525" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"> <Grid> <telerik:RadHeatMap HorizontalAlignment="Stretch" Name="RadHeatMap1" VerticalAlignment="Stretch" SnapsToDevicePixels="True" UseLayoutRounding="True"> <telerik:RadHeatMap.Definition> <telerik:CategoricalDefinition ItemsSource="{Binding}" RowGroupMemberPath="SensorIndex" ColumnGroupMemberPath="Timestamp" ValuePath="Temperature" /> </telerik:RadHeatMap.Definition> </telerik:RadHeatMap> </Grid></Window>