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>How does one grab the binding in order to force an update on a RadComboBox control?
MyRadComboBox.ItemsSource = MyObservableCollectionOfACustomClass;
MyRadComboBox.DisplayMemberPath = "Description";
Then, I try to grab the binding in a different control's event.
var binding = BindingOperations.GetBindingExpression(MyRadComboBox, RadComboBox.ItemsSourceProperty);
if (binding == null) return; // This is always null
binding.UpdateTarget();
