Telerik Forums
UI for WPF Forum
1 answer
246 views
Hi, I'm binding my ChartView to RadObservableCollection in a ViewModel, but I'm getting exceptions about trying to add to collection during CollectionChanged event handler working.
I'm suspending collection's notifications and resume them after adding element, but still getting this error (btw, only when chart becoming visible). Doing that from separate thread through Dispatcher.Invoke, also tried without that - not helping.
There are about 5-10 add operations per second. Can be more, can be less sometimes.
I was even trying to lock collection with locker object and then with (Collection as ICollection).SyncRoot. It doesn't help, only changing exception to InvalidArgumentException (index is out of range).
So, I'm frustrated
<telerik:RadCartesianChart x:Name="Chart"
                                   EmptyContent="Нет данных"
                                   Grid.Row="0"
                                   Grid.Column="0"
                                   Grid.ColumnSpan="2">
            <telerik:RadCartesianChart.Grid>
                <telerik:CartesianChartGrid MajorLinesVisibility="None"
                                            StripLinesVisibility="XY">
                    <telerik:CartesianChartGrid.YStripeBrushes>
                        <SolidColorBrush Color="SlateGray" />
                        <SolidColorBrush Color="SlateGray"
                                         Opacity="0.8" />
                    </telerik:CartesianChartGrid.YStripeBrushes>
                </telerik:CartesianChartGrid>
            </telerik:RadCartesianChart.Grid>
            <telerik:RadCartesianChart.VerticalAxis>
                <telerik:LinearAxis Minimum="0"
                                    MajorStep="5"
                                    Maximum="100"
                                    FontFamily="Segoe UI"
                                    FontSize="16"
                                    FontWeight="Bold"
                                    HorizontalLocation="Left"
                                    ElementBrush="Black" />
            </telerik:RadCartesianChart.VerticalAxis>
            <telerik:RadCartesianChart.HorizontalAxis>
                <telerik:DateTimeContinuousAxis MajorStepUnit="Minute"
                                                LabelInterval="10"
                                                FontFamily="Segoe UI"
                                                PlotMode="OnTicks"
                                                LabelFormat="HH:mm:ss.f"
                                                Minimum="{Binding HeatStartTime}"
                                                Maximum="{Binding HeatEndTime}" />
            </telerik:RadCartesianChart.HorizontalAxis>
            <telerik:LineSeries CategoryBinding="Time"
                                ValueBinding="CO"
                                ItemsSource="{Binding GasAnalysisChartData}"
                                Stroke="Red"
                                StrokeThickness="2">
            </telerik:LineSeries>
            <telerik:LineSeries CategoryBinding="Time"
                                ValueBinding="H2"
                                ItemsSource="{Binding GasAnalysisChartData}"
                                Stroke="Lime"
                                StrokeThickness="2">
            </telerik:LineSeries>
            <telerik:LineSeries CategoryBinding="Time"
                                ValueBinding="N2"
                                ItemsSource="{Binding GasAnalysisChartData}"
                                Stroke="Black"
                                StrokeThickness="2">
            </telerik:LineSeries>
            <telerik:LineSeries CategoryBinding="Time"
                                ValueBinding="O2"
                                ItemsSource="{Binding GasAnalysisChartData}"
                                Stroke="Blue"
                                StrokeThickness="2">
            </telerik:LineSeries>
            <telerik:LineSeries CategoryBinding="Time"
                                ValueBinding="Ar"
                                ItemsSource="{Binding GasAnalysisChartData}"
                                Stroke="Fuchsia"
                                StrokeThickness="2">
            </telerik:LineSeries>
            <telerik:LineSeries CategoryBinding="Time"
                                ValueBinding="CO2"
                                ItemsSource="{Binding GasAnalysisChartData}"
                                Stroke="Yellow"
                                StrokeThickness="2">
            </telerik:LineSeries>
        </telerik:RadCartesianChart>

private void ProcessGasAnalysisDataPiece(FlexEvent fex)
        {
            lock ((GasAnalysisChartData as ICollection).SyncRoot)
            {
                var gdata = new GasAnalysisChartDataModel
                {
                    Ar = (double)fex.Arguments["Ar"],
                    CO = (double)fex.Arguments["CO"],
                    CO2 = (double)fex.Arguments["CO2"],
                    H2 = (double)fex.Arguments["H2"],
                    N2 = (double)fex.Arguments["N2"],
                    O2 = (double)fex.Arguments["O2"],
                    Time = fex.Time
                };
                GasAnalysisChartData.SuspendNotifications();
                GasAnalysisChartData.Add( gdata );
                GasAnalysisChartData.ResumeNotifications();
            }
Sergey
Top achievements
Rank 1
 answered on 27 Apr 2013
0 answers
121 views
Hi telerik:
     View:
<Window.Resources>
        <HierarchicalDataTemplate x:Key="TreeItemTemplate" ItemsSource="{Binding Children}">
            <TextBlock Text="{Binding Header}" />
        </HierarchicalDataTemplate>
        <Style TargetType="telerik:RadTreeViewItem">
            <Setter Property="IsExpanded" Value="true" />
            <Setter Property="IsSelected" Value="{Binding Selected, Mode=TwoWay}" />
            <Setter Property="IsExpanded" Value="{Binding Expanded, Mode=TwoWay}" />
            <Setter Property="IsEditable" Value="{Binding IsEditable, Mode=TwoWay}"/>
            <Setter Property="IsInEditMode" Value="{Binding IsInEditMode, Mode=TwoWay}"/>
        </Style>
    </Window.Resources>
    <Grid>
        <StackPanel>
            <Button Content="Add" Margin="0,20" Width="40" HorizontalAlignment="Left" Click="Button_Click"></Button>
        <telerik:RadTreeView Grid.Row="1" IsEditable="True"
                telerik:AnimationManager.IsAnimationEnabled="False" ItemsSource="{Binding Items}"
                ItemTemplate="{StaticResource TreeItemTemplate}"
                             ScrollViewer.VerticalScrollBarVisibility="Auto"/>
        </StackPanel>
    </Grid>


When I Add a Item,set the IsInEditMode=true,click the Add button continuously,the last time added item,the Name will be null

why?

Bill
Top achievements
Rank 1
 asked on 27 Apr 2013
1 answer
62 views
So I've dragged a RadRichTextBox onto a window, and decided to see what properties are available to me for the control, but looking at them in the Properties window in VS 2012. When I get to the point of clicking on the Miscellaneous section I get an error (please see attached). I've tried this in more than 1 new project, and it does it consistently. Why? What's going on?

I'm working with Telerik.Windows.Controls runtime version 4.0.30319. And version number: 2012.3.1017.45
Vasil
Telerik team
 answered on 26 Apr 2013
1 answer
212 views
Hello,

Today, I added support for multiple selection in our tool. We are using the WPF RadPropertyGrid. 

So we modified the control to use :
SelectionMode="Multiple" and PropertySetMode="Intersection".

I am using the EditorTemplateSelector to select a custom editor for some class types such as "Point".

Before I did this when the PropertyGrid is in single selection mode:

if (item as PropertyDefinition != null && (item as PropertyDefinition).SourceProperty.PropertyType == typeof(System.Windows.Point))
{
return PointPropertyDataTemplate;
}

Now, with multiple selection, the SourceProperty.PropertyType is always of type System.Object. I understand it is now pointing to a dynamic model but it is still be important to keep the original type somewhere else in the parameter. It doesn't make sense to me to add a massive switch case with ALL (over 400) parameters hardcoded "names", and this create software very hard to maintain. I've read that you are working on the Editor Template Attribute that we could set in code but still I want to rely on the class type for single and multiple selection to avoid filling code with redundant attribute.

Do you have any suggestion for this? 

Also, having new converters for every class type when using multiple selection is also making my software filled with dozens of converter classes. Why is multiple selection absolutely require this as the property of every selected object is of the same type.

Thank you

Simon
Ivan Ivanov
Telerik team
 answered on 26 Apr 2013
4 answers
142 views
Hi,

I'm facing a rather nasty problem here with the ChartView.

I want to draw 4 zones on the chart which show the user if a signal is off, kind of like quality zones. See attached image for an example.
The first zone is running from +infinity on Y-axis to a given Y-value, the second zone starts from this Y-value down to another Y-value.
Then there is a "normal" zone, which doesn't need to be drawn and then starting from a third Y-value down to a fourth Y-value is the third zone. Finally the fourth zone starts from the fourth Y-value up unto -infinity on Y-axis.

You'll get something like this:
-------------------------------------------------- + INFINITY
ZONE 1
-------------------------------------------------- Y-value 1
ZONE 2
-------------------------------------------------- Y-value 2
NORMAL ZONE
-------------------------------------------------- Y-value 3
ZONE 3
-------------------------------------------------- Y-value 4
ZONE 4
-------------------------------------------------- - INFINITY

I tried using the area series and this works, but it's not really nice. I need to draw the series on top off each other and the normal zone needs to be drawn too, but then in white. Doing so doesn't make the rulers show. Making the normal zone more transparent, is just awful!

So I placed a Canvas on top of the ChartView and wanted to render rectangles over the ChartView. I finally came up with a transformation algorithm since there is no method on the ChartView to convert a data-point to a pixel coordinate. Right now I'm at the point that I have this working, but... now I need to correct for the zooming & scrolling too.

This feels so wrong and hope someone can shed a light on this problem and guide me towards another path?
Bottom line, am I missing something or is my method with the Canvas the only way?

Kind regards,
Dwight
Dwight
Top achievements
Rank 1
 answered on 26 Apr 2013
1 answer
94 views
I would like to have some pseudo preview after image was changed, so I would like to get image and preview it Image control.
E.g. I would like to didplay only image of size 180x180 but if image is bigger then I would display only top /left corner, so I would like to show user what will be displayed untill he accepts changes.

I would like to know when something was changed: rotated/sizechanged/customtool and then access to the chnaged image, that's all.
Is there any event that I can handle to be notified that command was executed?
Marcin
Top achievements
Rank 1
Veteran
 answered on 26 Apr 2013
3 answers
82 views
I am using MVVM. I wanted to know how to get the Node when you do right click on the node to View Model. My selected node and where am doing the right click is different
Maya
Telerik team
 answered on 26 Apr 2013
3 answers
107 views
Hello,

I've been trying out the Docker control and the persistence framework you provide. I must say I like how it works without requiring a lot of configuration. 

I'm having issues with the persisted full screen state. If I drag a pane that is float-able to my second monitor, where I make it full screen, upon reopening the application, the pane is made full screen on my main monitor. The same thing happens with the main window as well. 

If the window or pane isn't made full screen, the persisted layout works correctly.

Is this a bug or am I missing something? 
Thank you
Georgi
Telerik team
 answered on 26 Apr 2013
3 answers
237 views
Hi,

We recently updated our version of Telerik and I noticed a change in the content generated by the Export operation of the RtfFormatProvider. To better illustrate this, here's the result of an empty document exported to RTF for both the former and the new version of Telerik, using the following line of code :

new RtfFormatProvider().Export(new RadDocument());

With our former version (2011.3.1116.35), the result was the following (374 characters) :

{\rtf\ansi\ansicpg1252\uc1\deff0\deflang1033{\fonttbl{\f0 Verdana;}}{\colortbl\red0\green0\blue0 ;\red255\green255\blue255 ;}\nouicompat\viewkind4\paperw12240\paperh15840\margl1425\margr1425\margt1425\margb1425\deftab720\sectd\pgwsxn12240\pghsxn15840\marglsxn1425\margrsxn1425\margtsxn1425\margbsxn1425\headery720\footery720\pard\ltrpar\fs24\sl276\slmult1\sa180{\ltrch}\par}

With the new version (2012.2.0607.35), the result looks like this (3857 characters) :

{\rtf\ansi\ansicpg1252\uc1\deff0\deflang1033{\fonttbl{\f0 Verdana;}{\f1 Calibri;}}{\colortbl\red0\green0\blue0 ;\red255\green255\blue255 ;\red79\green129\blue189 ;\red0\green0\blue255 ;}{\*\defchp\ltrch\fs24\i0\b0\strike0\ulnone}{\*\defpap\sl276\slmult1\sa180}{\stylesheet{\*\ts2\tsrowd\sqformat\trbrdrt\brdrnone\trbrdrb\brdrnone\trbrdrl\brdrnone\trbrdrr\brdrnone\trbrdrh\brdrnone\trbrdrv\brdrnone\trgaph0\clpadft3\clpadt75\clpadfr3\clpadr75\clpadfl3\clpadl0\clpadfb3\clpadb0\tsvertalt\ltrch\i0\b0\strike0\ulnone\sl276\slmult1\sa180 TableNormal;}{\*\ts3\tsrowd\sbasedon2\sqformat\trbrdrt\brdrs\brdrw15\brdrcf0\trbrdrb\brdrs\brdrw15\brdrcf0\trbrdrl\brdrs\brdrw15\brdrcf0\trbrdrr\brdrs\brdrw15\brdrcf0\trbrdrh\brdrs\brdrw15\brdrcf0\trbrdrv\brdrs\brdrw15\brdrcf0\trgaph0\clpadft3\clpadt75\clpadfr3\clpadr75\clpadfl3\clpadl0\clpadfb3\clpadb0\tsvertalt\ltrch\i0\b0\strike0\ulnone\sl240\slmult1 TableGrid;}{\s0\sqformat\ltrch\i0\b0\strike0\ulnone\sl276\slmult1\sa180 Normal;}{\s5\sbasedon0\slink4\snext0\sqformat\ltrch\fs28\i0\b\strike0\cf2\ulnone\sl276\slmult1\sb480 Heading 1;}{\*\cs4\additive\slink5\ltrch\fs28\i0\b\strike0\cf2\ulnone Heading 1 Char;}{\s7\sbasedon0\slink6\snext0\sqformat\ltrch\fs26\i0\b\strike0\cf2\ulnone\sl276\slmult1\sb200 Heading 2;}{\*\cs6\additive\slink7\ltrch\fs26\i0\b\strike0\cf2\ulnone Heading 2 Char;}{\s9\sbasedon0\slink8\snext0\sqformat\ltrch\i0\b\strike0\cf2\ulnone\sl276\slmult1\sb200 Heading 3;}{\*\cs8\additive\slink9\ltrch\i0\b\strike0\cf2\ulnone Heading 3 Char;}{\s11\sbasedon0\slink10\snext0\sqformat\ltrch\i\b\strike0\cf2\ulnone\sl276\slmult1\sb200 Heading 4;}{\*\cs10\additive\slink11\ltrch\i\b\strike0\cf2\ulnone Heading 4 Char;}{\s13\sbasedon0\slink12\snext0\sqformat\ltrch\i0\b0\strike0\cf2\ulnone\sl276\slmult1\sb200 Heading 5;}{\*\cs12\additive\slink13\ltrch\i0\b0\strike0\cf2\ulnone Heading 5 Char;}{\s15\sbasedon0\slink14\snext0\sqformat\ltrch\i\b0\strike0\cf2\ulnone\sl276\slmult1\sb200 Heading 6;}{\*\cs14\additive\slink15\ltrch\i\b0\strike0\cf2\ulnone Heading 6 Char;}{\s17\sbasedon0\slink16\snext0\sqformat\ltrch\i\b0\strike0\ulnone\sl276\slmult1\sb200 Heading 7;}{\*\cs16\additive\slink17\ltrch\i\b0\strike0\ulnone Heading 7 Char;}{\s19\sbasedon0\slink18\snext0\sqformat\ltrch\fs20\i0\b0\strike0\ulnone\sl276\slmult1\sb200 Heading 8;}{\*\cs18\additive\slink19\ltrch\fs20\i0\b0\strike0\ulnone Heading 8 Char;}{\s21\sbasedon0\slink20\snext0\sqformat\ltrch\fs20\i\b0\strike0\ulnone\sl276\slmult1\sb200 Heading 9;}{\*\cs20\additive\slink21\ltrch\fs20\i\b0\strike0\ulnone Heading 9 Char;}{\s22\sbasedon0\snext0\sqformat\ltrch\f1\fs18\i0\b\strike0\cf2\ulnone\sl240\slmult1\sa180 caption;}{\s23\sbasedon0\snext0\ltrch\i0\b0\strike0\ulnone\sl276\slmult1\sa100 toc 1;}{\s24\sbasedon0\snext0\ltrch\i0\b0\strike0\ulnone\sl276\slmult1\li220\lin220\sa100 toc 2;}{\s25\sbasedon0\snext0\ltrch\i0\b0\strike0\ulnone\sl276\slmult1\li440\lin440\sa100 toc 3;}{\s26\sbasedon0\snext0\ltrch\i0\b0\strike0\ulnone\sl276\slmult1\li660\lin660\sa100 toc 4;}{\s27\sbasedon0\snext0\ltrch\i0\b0\strike0\ulnone\sl276\slmult1\li880\lin880\sa100 toc 5;}{\s28\sbasedon0\snext0\ltrch\i0\b0\strike0\ulnone\sl276\slmult1\li1100\lin1100\sa100 toc 6;}{\s29\sbasedon0\snext0\ltrch\i0\b0\strike0\ulnone\sl276\slmult1\li1320\lin1320\sa100 toc 7;}{\s30\sbasedon0\snext0\ltrch\i0\b0\strike0\ulnone\sl276\slmult1\li1540\lin1540\sa100 toc 8;}{\s31\sbasedon0\snext0\ltrch\i0\b0\strike0\ulnone\sl276\slmult1\li1760\lin1760\sa100 toc 9;}{\s32\sbasedon0\snext0\ltrch\i0\b0\strike0\ulnone\sl276\slmult1 table of figures;}{\*\cs33\additive\sqformat\ltrch\i0\b0\strike0\cf3\ulc3\ul Hyperlink;}}\nouicompat\viewkind4\paperw12240\paperh15840\margl1425\margr1425\margt1425\margb1425\deftab720\sectd\pgwsxn12240\pghsxn15840\marglsxn1425\margrsxn1425\margtsxn1425\margbsxn1425\headery720\footery720\pard\s0\ltrpar\sl276\slmult1\sa180{\ltrch\i0\b0\strike0\ulnone\par}}

The problem is that my client wants this data saved in a legacy database where the lengh of the data is restricted. With the tags generated by the new version, in the best case scenario, it severely restricts the amount of actual text that can be entered by the users, while in the worst case scenario the tags themselves are enough to exceed the restrictions.

Is there any way I could limit the amount of tags that are generated by default? Anything nearing what was generated by our former version 2011.3.1116.35 would be ideal.

If it can't be done, any other suggestion would also be welcome, knowing that :
  • I have no choice but to use RtfFormatProvider
  • The restrictions on the legacy database can't be changed in any way
  • Data can be restricted to as few as 2000 characters

Thank you!
Chethan
Top achievements
Rank 1
 answered on 26 Apr 2013
1 answer
149 views
Hello there

I am using the Office_BlueTheme and I am using the new RadRibbonBackstageItem.

I want to move away from the BackstageItem when I click on a MRU item. Basically I want the same behavior as when IsSelectable="False" 

Is there a way to manual switch to the default tab?

This is my MRU template:

<telerik:RadRibbonBackstageItem Header="Recent" IsDefault="True">
                 <Grid>
                     <Grid.ColumnDefinitions>
                         <ColumnDefinition Width="*" />
                         <ColumnDefinition Width="Auto" />
                         <ColumnDefinition Width="*" />
                     </Grid.ColumnDefinitions>
                     <StackPanel Margin="15 15 0 0">
                         <TextBlock Margin="0 0 0 2" FontSize="14" FontWeight="Bold" Text="Recent Documents" />
                         <Rectangle Height="1">
                             <Rectangle.Fill>
                                 <LinearGradientBrush MappingMode="Absolute" SpreadMethod="Repeat"
                                     StartPoint="0,0.5" EndPoint="4,0.5">
                                     <GradientStop Offset="0" Color="#40000000" />
                                     <GradientStop Offset="0.5" Color="#40000000" />
                                     <GradientStop Offset="0.501" Color="Transparent" />
                                 </LinearGradientBrush>
                             </Rectangle.Fill>
                         </Rectangle>
                         <ItemsControl Margin="0 4 0 0">
                             <ListView ItemsSource="{Binding Path=MruList}" SelectionMode="Single" BorderThickness="0">
                                 <ListView.ItemTemplate>
                                     <DataTemplate>
                                         <telerik:RadRibbonButton Content="{Binding Name}"
                                                                  Command="{Binding DataContext.OpenFromMruCommand,
                                                                            RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"
                                                                  CommandParameter="{Binding}"
                                                                  HorizontalAlignment="Stretch"/>
                                     </DataTemplate>
                                 </ListView.ItemTemplate>
                             </ListView>
                         </ItemsControl>
                     </StackPanel>
                 </Grid>
             </telerik:RadRibbonBackstageItem>


Kiril Vandov
Telerik team
 answered on 26 Apr 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?