Telerik Forums
UI for WPF Forum
2 answers
90 views

Hello - I run a simple system that looks at Sales orders, then with their associated country, changes the colour of that country on a map - pretty simple stuff.

 

Having that list of countries (shapes), is there a way to zoom so that they act as the zoom limits ie if only UK orders, only UK would be shown via zoom, or if UK and Australia, the map would center somewhere between the two, and zoom accordingly

 

Many thanks

Luke
Top achievements
Rank 1
 answered on 16 Apr 2015
7 answers
636 views
Is there a way to bind to lookup values in a gridview?

What I'm trying to achieve is nothing more complex than in Windows Forms ValueMember and DisplayMember:
This code is from the RadControls for WinForms example:Column Types
          
  //add new lookup column             
  GridViewLookUpColumn lookUpColumn = new GridViewLookUpColumn();             
  lookUpColumn.HeaderText = "Look up";                      
  lookUpColumn.FieldName = "PersonID";             
  lookUpColumn.DataSource = this.employeesBindingSource;             
  lookUpColumn.ValueMember = "EmployeeID";             
  lookUpColumn.DisplayMember = "LastName"

Given the classes below where the GridView binds to PriceList which is a collection of Price(s), I want the CommodityId column to be a combo box which, when in edit mode gives me a list of Commodity entities showing the Description text and when in view  mode shows me the Description text, but saves the Commodity.Id value back to AppPresenter.PriceList.

By including DataMemberPath in the CommodityId field of the DataView, I am able to display Commodity.Description. However, the selected value from the combo is not reflected in the underlying datasource (PriceList).
If I remove DataMemberPath from the markup - it is clear to see that the PriceList is never updated with the newly selected value.

I'm guessing that the reason for this is that I am not binding Commodity.Id (in the lookup) to CommodityId in the GridView. So my question is - how do I do this binding? The example for DataBinding doesn't seem to cover this case.


public class Commodity() 
    public int Id {get;set;} 
    public string Description {get;set;} 
     
    public override ToString() 
    { 
        return Description; 
    } 
 
public class Price 
    public int Id {get;set;} 
    public DateTime Date {get;set;} 
    public int CommodityId {get;set;} 
    public EntityRef<Commodity> Commodities {getset;} 
public class AppPresenter 
    public ObservableList<Price> PriceList {get;} 
 
public class Shell 
    pubic Shell() 
    private IList<Commodity> _commodityList; 
    { 
        InitializeComponents();  
         
        _commodityList = repository.GetCommodites(); 
        colCommodityEditorSettings = new ComboBoxEditorSettings { ItemsSource = _commodityList};             
            colCommodity.EditorSettings = colCommodityEditorSettings; 
        } 

 
 <telerik:RadGridView Grid.ColumnSpan="4" Grid.Row="3" Margin="5" x:Name="radGridView1" ColumnsWidthMode="Auto" ItemsSource="{Binding Path = PriceList}"  
                             AutoGenerateColumns="False"
            <telerik:RadGridView.Columns> 
                <telerik:GridViewDataColumn DataType="{x:Null}" HeaderText="ID" UniqueName="Id" x:Name="colId" /> 
                <telerik:GridViewDataColumn DataType="{x:Null}" HeaderText="Date" UniqueName="Date" IsAutoGenerated="False" IsVisible="True" x:Name="colDate" /> 
                <telerik:GridViewDataColumn DataType="{x:Null}" HeaderText="Hidden" UniqueName="IsHidden" x:Name="colIsHidden" /> 
                <telerik:GridViewDataColumn DataType="{x:Null}" HeaderText="Commodity" UniqueName="CommodityId" x:Name="colCommodity" DataMemberPath="Commodities.Description">   
</telerik:RadGridView>                 
 
 

Many thanks in advance for your help
Jeremy Holt

Dimitrina
Telerik team
 answered on 16 Apr 2015
2 answers
105 views

I would replace the text %Doctors% at the runtime by a table. The following code does not work.

private void ReplaceAllMatches(string Parameter, Telerik.Windows.Documents.Model.Table NewTable)
{
this.myViewer.Document.Selection.Clear(); // this clears the selection before processing
DocumentTextSearch search = new DocumentTextSearch(this.myViewer.Document);
List<Telerik.Windows.Documents.TextSearch.TextRange> rangesTrackingDocumentChanges = new List<Telerik.Windows.Documents.TextSearch.TextRange>();
foreach (var textRange in search.FindAll(Parameter))
{
Telerik.Windows.Documents.TextSearch.TextRange newRange = new Telerik.Windows.Documents.TextSearch.TextRange(new DocumentPosition(textRange.StartPosition, true), new DocumentPosition(textRange.EndPosition, true));
rangesTrackingDocumentChanges.Add(newRange);
}
foreach (var textRange in rangesTrackingDocumentChanges)
{
this.myViewer.Document.Selection.AddSelectionStart(textRange.StartPosition);
this.myViewer.Document.Selection.AddSelectionEnd(textRange.EndPosition);
this.myViewer.InsertTable(NewTable,true);
textRange.StartPosition.Dispose();
textRange.EndPosition.Dispose();
}
}

 

Harald
Top achievements
Rank 2
 answered on 15 Apr 2015
1 answer
83 views

A simple problem .. I need to insert an ExtendedData  property dynamically during runtime based on a user selection.  (Or, I could hack it and change the value of an existing extended property - I don't really care at this point).    I tried added the new property in the PreviewReadShapesCompleted event, but the colorizer doesn't recognize it.  Even if I change an existing ExtendedData property's value, the colorizer does not reset it's range. 

Is there some way to refresh the colorizer?  I've tried setting a MinValue and MaxValue and binding the colorizer's Min and Max values to them but that doesn't work either.

For example, using the sample from WPF SDK for InformationLayerColorizerModeCount (world.shp/world.dbf) , I change the value of the "SQKM" property in the InformationLayerColorizerModeCount event by dividing it by 10.  When the map shows,  all countries are pretty much the same color.  If I divide it by 5, there is more variation in color, but not as much.  If I multiply it by 10, than all countries are dark with little or no variation. 

 Debugging shows me that ColorMeasureScale_PrepareCompleted fires before the PreviewReadShapesCompleted event and apparently sets it range of values from the original DBF values.

I tried to read the shape files in manually ( http://docs.telerik.com/devtools/wpf/controls/radmap/features/information-layer/shapefiles-support)  )  , modify the stream, and pass that into the  ShapeReader, but the "shapes" do not contain an ExtendedPropertySet so I can't manipulate the values. 

 

StreamResourceInfo shapeResourceInfo = Application.GetResourceStream(new Uri("/InformationLayerColorizerModeCount;component/Resources/world.shp", UriKind.RelativeOrAbsolute));
StreamResourceInfo dbfResourceInfo = Application.GetResourceStream(new Uri("/InformationLayerColorizerModeCount;component/Resources/world.dbf", UriKind.RelativeOrAbsolute));
Telerik.Windows.Controls.Map.ExtendedPropertySet extData = new ExtendedPropertySet();
List<FrameworkElement> shapes = new List<FrameworkElement>();
var x = ShapeFileReader.Read(shapeResourceInfo.Stream, dbfResourceInfo.Stream);
foreach (var shape in shapes)
{
    this.informationLayer.Items.Add(shape);
}

​

 In the foreach loop, I want to grab a value from my  model for the specific country, and then either change the value of an existing ExtendedData or create a new one, but the "shape" instance does not have any property that allows me to do this despite the fact that I included the DBF file in the Read method. 

Maybe I should use a different technique altogether ?   It seems that this requirement would be quite common, i.e. user picks a variable, program colorizes the map according to that variable.  What am I missing ? 

Thanks

​

​

​

Pavel R. Pavlov
Telerik team
 answered on 15 Apr 2015
12 answers
285 views
Hello,

My scenario is similar to the Hotel Floorplan given in your online demos. 

I already have created some Shapefiles (*.shp) using OpenJump 1.7.1. which are working fine when used as local resource for a MapShapeReader
in an InformationLayer.
But i want the shapefiles to be stored in my database as byte[].
Even loading of the files works perfectly in my viewmodel (via service call).

So now to my problem and actual questions (keep in mind that I am using MVVM):
 -) Is it possible to load many (about 20-30) shapefiles from database and bind them to the same radmap control in my view and if so, HOW?
 -) Which datatypes do i have to use?
 -) Is saving *.shp files to the database the best solution?
 -) Would it be better to use *.kml or *.wkt files?

Regards,
Thomas

Petar Mladenov
Telerik team
 answered on 15 Apr 2015
1 answer
197 views

I am trying to set the selected Item of a TreeListView by code (two way binding), but I see the selected item is set back to null by telerik on few cases. 

Have a complex hierarchy tree structure, their child parent level goes down to 10 level at-least. I am trying to set the selected item by code when some one picks the respective item from some where else. And I see, the selected item is set to null by telerik code when an at-least two ancestors nodes are collapsed, but works only one ancestor node is collapsed or when the ancestor nodes are expanded. Not sure about this behavior, could you explain this behavior ? and is there any work around ? 

  Anand​

Dimitrina
Telerik team
 answered on 15 Apr 2015
1 answer
154 views

Hi,

 We are using Rad Map in one of our application where we have used Visualization Layer to show labels on the map.

As per our requirement we need to show current position of active device on map. To make it functional we are using timer to get updated position of the device at regular interval and then we are binding the data with Map using Visualization Source class.   But each time when we are binding the data labels on the map are blinking. 

 

 

 

Petar Mladenov
Telerik team
 answered on 15 Apr 2015
3 answers
433 views

Hi,

 

When I add a new item to the bound collection in my view model the radgridview scrolls to the top on its own.

How to prevent this from happening ? I saw a similar thread with no solution : http://www.telerik.com/forums/disable-scroll-on-changing-collection

Dimitrina
Telerik team
 answered on 15 Apr 2015
5 answers
124 views

Hi, 

 

I need my scatter graph to have equal x and y spacings so the grid lines will appear square. I've attached images of the default spacing I currently have and the square spacing I need.

 

Thanks for any help,

Milena
Telerik team
 answered on 15 Apr 2015
1 answer
77 views

As the title suggests, I'm trying to work with the max value of the gauge with my data and I'm having little luck. I am fairly new to telerik/wpf, so maybe that's also part of the issue, but what I'm wanting to do is stop the needle at the maximum value (my gauge goes from 0-200, if it's over that value, it just continues along the gauge until it goes past 0 again and the data is skewed). 

 

I've seen an example somewhere of a gauge that when the maximum is exceeded, it stops there and kind of bounces back and forth, as if to indicate it's trying to reach past that point but can't. Is there a way to do this that I'm unaware of?

Pavel R. Pavlov
Telerik team
 answered on 15 Apr 2015
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
Book
FileDialogs
ToolBar
ColorPicker
TimePicker
SyntaxEditor
MultiColumnComboBox
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
DesktopAlert
WatermarkTextBox
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
ProgressBar
Sparkline
LayoutControl
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
Rating
SplashScreen
Accessibility
Callout
CollectionNavigator
Localization
AutoSuggestBox
VirtualKeyboard
HighlightTextBlock
Security
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?