<Label FontSize="18" Padding="0" Content="{Binding Effective_Date, StringFormat=d}" /><HierarchicalDataTemplate x:Key="TreeObjectTemplate" ItemContainerStyle="{StaticResource containerStyle}" ItemsSource="{Binding ChildNodes}"> <StackPanel Orientation="Horizontal"> <TextBlock Text="{Binding DisplayName}" /> </StackPanel></HierarchicalDataTemplate> <telerik:RadTreeView Grid.Row="0" x:Name="tvTree" ItemTemplate="{StaticResource TreeObjectTemplate}" Margin="0,8,0,4" VerticalAlignment="Top" Padding="0,2,0,10" IsSingleExpandPath="False" IsLineEnabled="True" ExpanderStyle="{DynamicResource ExpanderStyle}" SelectionMode="Single" IsEditable="False" IsDragDropEnabled="False" ItemContainerStyle="{StaticResource containerStyle}" ItemsSource="{Binding tvTreeData}" SelectedItem="{Binding tvSelectedItem, Mode=TwoWay}" MouseRightButtonDown="treeView_MouseRightButtonDown"> <telerik:RadContextMenu.ContextMenu> <telerik:RadContextMenu> <telerik:RadMenuItem Header="Expand All Levels" Command="{Binding ExpandCommand}"/> <telerik:RadMenuItem Header="Collapse All Levels" Command="{Binding CollapseCommand}"/> </telerik:RadContextMenu> </telerik:RadContextMenu.ContextMenu> <i:Interaction.Triggers> <i:EventTrigger EventName="PreviewUnselected"> <Command:EventToCommand Command="{Binding Path=PreviewUnselectedCommand, Mode=OneWay}" PassEventArgsToCommand="True"/> </i:EventTrigger> <i:EventTrigger EventName="PreviewSelected"> <Command:EventToCommand Command="{Binding Path=PreviewSelectedCommand, Mode=OneWay}" PassEventArgsToCommand="True"/> </i:EventTrigger> </i:Interaction.Triggers> </telerik:RadTreeView>private void ExpandAllChildren(MyTreeNode node, bool bExpandOrCollapse){ foreach (MyTreeNode childNode in node.ChildNodes) { ExpandAllChildren(childNode, bExpandOrCollapse); } if (node.ChildNodes.Count > 0) node.IsExpanded = bExpandOrCollapse;}private RelayCommand _expandCommand;public ICommand ExpandCommand{ get { if (_expandCommand == null) { _expandCommand = new RelayCommand(() => { try { UICursor = Cursors.Wait; ExpandAllChildren(tvSelectedItem, true); } catch { } finally { UICursor = Cursors.Arrow; } }); } return _expandCommand; }}I’ve problems binding an ObservableCollection<ISpatial> SpatialPolyItemCollection as Source in SqlGeospatialDataReader.
Nothing shows up in the map.
ISpatial is an Interface for a class Spatial containing Wkt to represent the polygon.
<telerik:InformationLayer x:Name="spatialPolyLayer">
<telerik:InformationLayer.Reader>
<telerik:SqlGeospatialDataReader x:Name="GeoReader" PreviewReadCompleted="PreviewReadCompleted"
Source="{Binding SpatialPolyItemCollection}" GeospatialPropertyName="Wkt" ToolTipFormat="Navn">
</telerik:SqlGeospatialDataReader>
</telerik:InformationLayer.Reader>
</telerik:InformationLayer>
I can make it work in code behind by adding GeoReader.Source = SpatialPolyItemCollection.
Any Ideas how I can make this binding work without the code behind line?
I know that my collection is valid because it works fine if I use the same collection inside a GridView
<telerik:RadGridView x:Name="gridGeometriView" SelectionMode="Extended"
ItemsSource="{Binding SpatialPolyItemCollection}" FrozenColumnCount="2" SelectionChanged="GridViewSelectionChanged"/>
public static T GetPreviousSameLineAnnotationRangeStart<T>(this RadDocument document) where T : AnnotationRangeStart{ //Document caret position DocumentPosition caretPosition = new DocumentPosition(document.CaretPosition); //Caret Line Info ParagraphLineInfo caretLineInfo = caretPosition.GetCurrentInlineBox().LineInfo; //Next Annotation LineInfo variable ParagraphLineInfo previousAnnotationLineInfo = null; if (!document.Selection.IsEmpty) { document.CaretPosition.MoveToPosition(document.Selection.Ranges.Last.StartPosition); } InlineLayoutBox inlineLayoutBox = document.CaretPosition.GetCurrentInlineBox(); do { inlineLayoutBox = (InlineLayoutBox)DocumentStructureCollection.GetPreviousElementOfType(inlineLayoutBox, typeof(AnnotationMarkerLayoutBox)); } while (inlineLayoutBox != null && !(inlineLayoutBox.AssociatedInline is AnnotationRangeStart)); if (inlineLayoutBox == null) { return null; } else { //Get next annotation lineinfo if next annotation exists previousAnnotationLineInfo = inlineLayoutBox.LineInfo; } //Compare caret & next annotation lines if (previousAnnotationLineInfo != caretLineInfo) { return null; } return inlineLayoutBox.AssociatedInline as T;}public static T GetNextSameLineAnnotationRangeStart<T>(this RadDocument document) where T : AnnotationRangeStart{ //Document caret position DocumentPosition caretPosition = new DocumentPosition(document.CaretPosition); //Caret Line Info ParagraphLineInfo caretLineInfo = caretPosition.GetCurrentInlineBox().LineInfo; //Next Annotation LineInfo variable ParagraphLineInfo nextAnnotationLineInfo = null; if (!document.Selection.IsEmpty) { document.CaretPosition.MoveToPosition(document.Selection.Ranges.Last.EndPosition); } InlineLayoutBox inlineLayoutBox = document.CaretPosition.GetCurrentInlineBox(); while (inlineLayoutBox != null && !(inlineLayoutBox.AssociatedInline is AnnotationRangeStart)) { inlineLayoutBox = (InlineLayoutBox)DocumentStructureCollection.GetNextElementOfType(inlineLayoutBox, typeof(AnnotationMarkerLayoutBox)); } if (inlineLayoutBox == null) { return null; } else { //Get next annotation lineinfo if next annotation exists nextAnnotationLineInfo = inlineLayoutBox.LineInfo; } T annotationRangeStart = inlineLayoutBox.AssociatedInline as T; if (annotationRangeStart == null) { return null; } //Compare caret & next annotation lines if (nextAnnotationLineInfo != caretLineInfo) { return null; } return annotationRangeStart;}SemanticRangeStart sameLinePreviousAnnotation = RadDocumentExtensions.GetPreviousSameLineAnnotationRangeStart<SemanticRangeStart>(this.radRichTextBox.Document);if (sameLinePreviousAnnotation == null){ MessageBox.Show("No previous annotations");}else{ MessageBox.Show("Name: " + sameLinePreviousAnnotation.Product.Name.ToString() + "\n\nHas Child: " + sameLinePreviousAnnotation.Product.HasChild.ToString());}SemanticRangeStart sameLineNextAnnotation = RadDocumentExtensions.GetNextSameLineAnnotationRangeStart<SemanticRangeStart>(this.radRichTextBox.Document);if (sameLineNextAnnotation == null){ MessageBox.Show("No next annotations");}else{ MessageBox.Show("Name: " + sameLineNextAnnotation.Product.Name.ToString() + "\n\nHas Child: " + sameLineNextAnnotation.Product.HasChild.ToString());}Color kdcol = ITA_CRM.Klassen.helper.HexColor("#FF008062"); // kdcol = "#FF008062" this.KundenColorRCE.SelectedColor = kdcol;this.KundenColorRCE.InitialColor = kdcol;
<telerik:RadDocumentPane x:Class="RadControlsWpfApp1.RadControlsScenario1"<br> xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"<br> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"<br><span class="Apple-tab-span" style="white-space:pre"> </span>xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"<br> xmlns:d="http://schemas.microsoft.com/expression/blend/2008"<br> xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"<br> Header="RadControlsScenario1" mc:Ignorable="d" d:DesignHeight="288" d:DesignWidth="290"><br> <Grid><br> <TextBlock Text="Blah blah blah"/><br> </Grid><br></telerik:RadDocumentPane>