Telerik Forums
UI for WPF Forum
2 answers
64 views
Hi,

I have an existing system using RadMap which works well. It displays a shapefile with MapPinPoints overlayed on top. One problem we had was that we couldn't zoom beyond zoomlevel 20; however I have downloaded the latest trial version which has a fix for this (setting MaxZoomLevel).

The problem is that when I now zoom beyond zoomlevel 20, all the MapPinPoints disappear but the shapefile is still rendered in the background. The shapefile is loaded using a DynamicLayer and the MapPinPoints are loaded onto an InformationLayer.

Is this a known issue or am I missing something?

Thanks,
Stuart
Stuart
Top achievements
Rank 1
 answered on 20 Feb 2012
0 answers
107 views
Hi,
I have tried the example, ICollectionView Synchronisation whereby u have a grid and a dataform.

Now i want to save a new record, and edit a new record and want my changes to be saved to sql server database and also reflect the changes in the datagrid that is if i add a new record i should see it.
Can anyone please guide me on how to do this ?

Also i wanted to know, if i have a class , say employee, and all the content on my dataform , labels and textboxes have been generated based on the properties of this class, then how do i do if i want to get the valye from a particular textbox at runtime ? since it is generated, will there be an id or name associated with it ?

I hope to get some help very soon.
Regards,
Shaimaa
Shaimaa
Top achievements
Rank 1
 asked on 19 Feb 2012
3 answers
170 views
Hello,

I have an issue where I need some help. I am creating an WPF MVVM application. I have a view with in it displayed a RadGridView. One of the columns of this gridview is a GridViewComboBoxColumn. See code
<telerik:RadGridView x:Name="GridView"  
    ItemsSource="{Binding DataContext.ObservDistributions, ElementName=DistributionView}"  
    AutoGenerateColumns="False"  
    CanUserFreezeColumns="False" 
    acb:CommandBehavior.Event="MouseDoubleClick"  
    acb:CommandBehavior.Command="{Binding SelectCurrentDistributionCommand}" 
    acb:CommandBehavior.CommandParameter="{Binding ElementName=GridView, Path=SelectedItem}"
        <telerik:RadGridView.Columns> 
        <telerik:GridViewDataColumn Header="Name" DataMemberBinding="{Binding Name}" IsReadOnly="True" /> 
        <column:DateTimePickerColumn Header="Date" DataMemberBinding="{Binding DateFrom}" Width="200"></column:DateTimePickerColumn> 
        <telerik:GridViewComboBoxColumn Header="Establishment" ItemsSource="{Binding DataContext.Establishments, ElementName=DistributionView}" SelectedValueMemberPath="EstablishmentId" DisplayMemberPath="Name" DataMemberBinding="{Binding Establishment.EstablishmentId, Mode=TwoWay}"
        </telerik:GridViewComboBoxColumn> 
    </telerik:RadGridView.Columns> 
</telerik:RadGridView> 
              
I have in the ViewModel a ObservableCollection named "ObservDistributions". This all works perfectly. The issue is where I change the value of the GridViewComboBoxColumn. I use MouseDoubleClick to send the changes from the View to the ViewModel.  In the acb:CommandBehavior.CommandParameter I sent the item to the ViewModel with a command. This all works but not for the GridViewComboBoxColumn. The changes made to the GridViewComboBoxColumn are not sent to the ViewModel. I think the issue is with the DataMemberBinding in the GridViewComboBoxColumn. I have used the DateTimePickerColumn from Telerik, changes made with this control works fine.

Does anyone have some hint in what direction to look.

Thanx in advance

Stefan
Kareem Azzouny
Top achievements
Rank 1
 answered on 19 Feb 2012
7 answers
370 views
I can insert a comment but when I try to type in the comment I can only type one letter and then the cursor moves back to the document area.
<telerikHTML:HtmlDataProvider Name="dp1" Html="{Binding TaskText, Mode=TwoWay}" RichTextBox="{Binding ElementName=TaskEditor}" />
<telerik:RadRichTextBox x:Name="TaskEditor" Grid.Row="1" Grid.Column="1" Margin="0,5,0,5"
                    AllowDrop="True"  ShowComments="True"
                    IsSelectionMiniToolBarEnabled="false"
                    LayoutMode="Flow"
                    DocumentInheritsDefaultStyleSettings="True"
                    GotFocus="EditorGotFocus" LostFocus="EditorLostFocus"/>
private void EditorGotFocus(object sender, RoutedEventArgs e)
      {
          _lastDataContext = _contextualTabView.DataContext;
          _contextualTabView.DataContext = TaskEditor.Commands;
          _lastTab = _ribbonView.SelectedTab;
          _contextualGroup.IsActive = true;
      }
 
      private void EditorLostFocus(object sender, RoutedEventArgs e)
      {
          _contextualGroup.IsActive = false;
          _lastTab.IsSelected = true;
          _contextualTabView.DataContext = _lastDataContext;
      }

Iva Toteva
Telerik team
 answered on 17 Feb 2012
7 answers
281 views
I'm trying to get the word I just wrote.
I tried these methods.

private void EditorPreviewEditorKeyDown(object sender, PreviewEditorKeyEventArgs e)
{
  var word = radRichTextBox.Document.CaretPosition.GetCurrentWord();
or... var word = radRichTextBox.Document.CaretPosition.GetCurrentSpanBox().Text;.

But none of them gives me the desired result.
Do they work in Wpf? What do they do? How could I get the word 'at the caret'?
Where can I read (wpf)documentation about this?
Ivailo Karamanolev
Telerik team
 answered on 17 Feb 2012
7 answers
190 views
If I have the following column in a radgrid, could someone help me with code behind on how to set the image source programtically based on a column value?

<telerik:GridViewColumn Header="Notes" Width="50">

<telerik:GridViewColumn.CellTemplate>

<DataTemplate>

<telerik:RadButton Name="btnObj" Height="25" Width="25" Click="btnObj_Click">

<telerik:RadButton.Content>

<Image Name="imgNotes" Source="/Images/notes.png" Height="16" Width="16" />

</telerik:RadButton.Content>

 

</telerik:RadButton>

</DataTemplate>

</telerik:GridViewColumn.CellTemplate>

Colin Wright
Top achievements
Rank 2
 answered on 17 Feb 2012
2 answers
135 views
Am I mistaken in understanding that the RadChart control cannot recognize beyond the Day component of a DateTime with regards to specificity. I plotted five values and they all appeared along the origin. Their X-values were different by seconds.
Evgenia
Telerik team
 answered on 17 Feb 2012
1 answer
108 views
I have some logic that will determine what style should be used on a per cell basis. Is there a way to have a style selector for the cells in the scheduler?
Konstantina
Telerik team
 answered on 17 Feb 2012
7 answers
317 views
Hi,

I have a chart (Line) bound to an ObservableCollection containing objects with a DateTime and an int value.
There are a number of problems I ran into with this solution.
So let me first explain the solution (desired result).
The YAxis should display values from 0 to 255 (byte range).
The XAxsi should display a certain number of seconds from the beginning of the data to the end.
To explain it assume 10 seconds of display.
So I check the first datapoint subtract 0.5 seconds (for better display) and set this as XMin.
Then I add 10 seconds and set this as XMax.

While running the programm I add values to the collection and if the latest value is older than the first value + 10 seconds I remove items from the front of the collection.
So what I get is a "growing" display of datapoint - than a "scroll" and again it adds data point....
I have this working - but now my problems (I guess I do something wrong) start.
You can imagine the solution as some kind of "live trend display".

Here the code to setup the chart.
private void InitGrid() {  
    rcData.DefaultView.ChartArea.EnableAnimations = false;  
    rcData.DefaultView.ChartLegend.Visibility = System.Windows.Visibility.Collapsed;  
    rcData.DefaultSeriesDefinition = new LineSeriesDefinition();  
    rcData.DefaultSeriesDefinition.Appearance.Stroke = Brushes.Red;  
    rcData.DefaultSeriesDefinition.Appearance.StrokeThickness = 2;  
    rcData.DefaultSeriesDefinition.ShowItemToolTips = true;  
    rcData.DefaultView.ChartArea.AxisX.IsDateTime = true;  
    rcData.DefaultView.ChartArea.AxisX.LabelRotationAngle = 80;  
    //60 would be better - but then the last label is truncated...  
    rcData.DefaultView.ChartArea.AxisX.DefaultLabelFormat = "HH:mm:ss";  
    rcData.DefaultView.ChartArea.AxisX.LayoutMode = AxisLayoutMode.Normal;  
    rcData.DefaultView.ChartArea.AxisX.AutoRange = false;  
 
    if(m_ocData.Count > 0) {  
        rcData.DefaultView.ChartArea.AxisX.MinValue = m_ocData.First().MeassureTime.AddSeconds(-0.5).ToOADate();  
        rcData.DefaultView.ChartArea.AxisX.MaxValue = m_ocData.First().MeassureTime.AddSeconds(ms_nWindowLength + 1).ToOADate();  
    }  
 
    rcData.DefaultView.ChartArea.AxisX.LabelStep = 1;  
    rcData.DefaultView.ChartArea.AxisX.MajorGridLinesVisibility = Visibility.Visible;  
    rcData.DefaultView.ChartArea.AxisX.Step = 0.000022890946517388029 / 2;  
 
    rcData.DefaultView.ChartArea.AxisY.AutoRange = false;  
    rcData.DefaultView.ChartArea.AxisY.MinValue = 0;  
    rcData.DefaultView.ChartArea.AxisY.MaxValue = 255;  
    rcData.DefaultView.ChartArea.AxisY.MinorTicksVisibility = Visibility.Collapsed;  
 
      
 
    rcData.DefaultView.ChartArea.ItemToolTipOpening += new ItemToolTipEventHandler(ChartArea_ItemToolTipOpening);  
    SeriesMapping seriesMapping = new SeriesMapping();  
    seriesMapping.ItemMappings.Add(new ItemMapping("TheValue", DataPointMember.YValue));  
    seriesMapping.ItemMappings.Add(new ItemMapping("MeassureTime", DataPointMember.XValue));  
    rcData.SeriesMappings.Add(seriesMapping);  
    rcData.ItemsSource = m_ocData;  
    //if done before binding it doesn't work :(  
    rcData.DefaultView.ChartArea.AxisY.TickPoints.Clear();  
    rcData.DefaultView.ChartArea.AxisY.TickPoints.Add(new TickPoint() { Value = 0 });  
    rcData.DefaultView.ChartArea.AxisY.TickPoints.Add(new TickPoint() { Value = 50 });  
    rcData.DefaultView.ChartArea.AxisY.TickPoints.Add(new TickPoint() { Value = 100 });  
    rcData.DefaultView.ChartArea.AxisY.TickPoints.Add(new TickPoint() { Value = 150 });  
    rcData.DefaultView.ChartArea.AxisY.TickPoints.Add(new TickPoint() { Value = 200 });  
    rcData.DefaultView.ChartArea.AxisY.TickPoints.Add(new TickPoint() { Value = 255 });  
 
}  
 
 
By the way: DataPoints near 0 (0-15) have their label outside the chart - only partial visible

First problem:
When I add the first entry (my collection has one entry) I see a little part of a line - but not no DataPoint (label).

The next problems.
For YAxis I have min==0 max==255 (or 260 if this would help - it doesn't)
I messed around a lot with YAxis settings to have a scale showing 0, 50, 100, 150, 200, 255 (250 or 260 would be OK also).
The Step property doesn't help.
If I set it to 50 I get 51, 102, 153, 205, 255
Setting it to 49, 48 and 47 brings the same result.
With 46 I get 42.5, 85, 127,5.... :)
The only solution I found was to clear the TickPoints and add my values manually.
The problem - the TickPoints are newly created after I bind the data.
I solved this (although I don't understand why it is like this - I said "AutoRange" to off) by clearing / adding the ticks AFTER data binding.

When I reach the end of the space in the chart I do some kind of scroll. This means I remove the first xxx Items till the data fits again.
And because I have "manual XAxis" I change the XMinValue and the XMaxValue to reflect the changes.
The code looks (shoul look) like this:
    if(m_ocData.Count > 0) {  
        rcData.DefaultView.ChartArea.AxisX.MinValue = m_ocData.First().MeassureTime.AddSeconds(-0.5).ToOADate();  
        rcData.DefaultView.ChartArea.AxisX.MaxValue = m_ocData.First().MeassureTime.AddSeconds(ms_nWindowLength+1).ToOADate();  
    }  
 

Here is the next Problem:
AxisX seems to "forget" the setting for Step when I do this.
So I have to set it again!!!

And the next "interesting" thing:
 YAxis also resets it's TickPoints after I do this
So I have to set the values again.
Finally I had to use:
private void ScrollGrid() {  
    if(m_ocData.Count > 0) {  
        rcData.DefaultView.ChartArea.AxisX.MinValue = m_ocData.First().MeassureTime.AddSeconds(-0.5).ToOADate();  
        rcData.DefaultView.ChartArea.AxisX.MaxValue = m_ocData.First().MeassureTime.AddSeconds(ms_nWindowLength+1).ToOADate();  
    }  
    //set some values again - they get lost  
    rcData.DefaultView.ChartArea.AxisX.Step = 0.000022890946517388029 / 2;  
      
    rcData.DefaultView.ChartArea.AxisY.TickPoints.Clear();  
    rcData.DefaultView.ChartArea.AxisY.TickPoints.Add(new TickPoint() { Value = 0 });  
    rcData.DefaultView.ChartArea.AxisY.TickPoints.Add(new TickPoint() { Value = 50 });  
    rcData.DefaultView.ChartArea.AxisY.TickPoints.Add(new TickPoint() { Value = 100 });  
    rcData.DefaultView.ChartArea.AxisY.TickPoints.Add(new TickPoint() { Value = 150 });  
    rcData.DefaultView.ChartArea.AxisY.TickPoints.Add(new TickPoint() { Value = 200 });  
    rcData.DefaultView.ChartArea.AxisY.TickPoints.Add(new TickPoint() { Value = 255 });  
}  
 

I guess I do something wrong because:
a.) Why should the chart overwrite settings I made when I change a ( totally different) setting
--like with XMinValue and XMaxValue which overrides AxisY.TickPoints
b.) Why should the chart change my TickPoints when I bind data?
--although I told it that I don't want AutoRange
c.) Why is there no easy way to tell the chart "pleas divide my XAxis to seconds"
--OK - would not help here - I need the "free space" to add points (and I found no X-Range property)
--I tried "continuous" scrolling (simply adding a point to the end - and remove on on the front of my collection)
--This flickers so much - unusable :(
d.) Why is "step" for the AxisY divider and not step?
--If Step 50 would (on 0 to 255) would bring 0, 50, 100, 150, 200, 250) would be great (and expected)

My Intention (and the results from what I found):
Have a chart with Y-Labels 0, 50, 100, 150, 200, 250 (or 255)
Has to be done manually - no problem if these values wouldn't been overridden by databind or changing XAxis min / max.
Have an XAxis with a label every second and a display range of 15 seconds (just a number).
Not possible
- I found no way to declare "1 second label distance"
- I found no way to say "XRange 30 seconds"
So I had to do it manually.
But I ran in the problem that AxisX.Step is overwritten when I change the min/max.

I hope someone can tell me what I'm doing wrong.
I have it working - but I guess what I do is "hacking in the dark" :)

Regards

Manfred
Petar Marchev
Telerik team
 answered on 17 Feb 2012
0 answers
85 views
Hi,

is there any example for a dynamic mvvm Model based on a sql-database?

thanks
regards
ww
ITA
Top achievements
Rank 1
 asked on 17 Feb 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?