Telerik Forums
UI for WPF Forum
7 answers
267 views
I am creating some rather large diagrams that take some time to load, so I am using a busy indicator to display while the diagram loads. I run this busy indicator in a background thread to keep the UI responsive. Once the loading is complete in the RunWorkerCompleted method I set the GraphSource property in my ViewModel which is bound to my diagram. I am subscribing to the GraphSourceChanged event of the diagram, at which point I set the layout to be ​'TreeLayoutType.TreeDown'. 

This was working perfectly until I introduced the busy indicator on a seperate thread. The GraphSourceChanged still gets called at the appropriate time however the diagram does not layout at all with all of the diagram items stacked on top of each other. Im assuming this is a threading issue, but thought it would work correctly as in setting the databound GraphSource property on the RunWorkerCompleted which should be using the UI thread.

Any help appreciated.
Pavel R. Pavlov
Telerik team
 answered on 24 Apr 2014
1 answer
197 views
Hi,

I have a problem serializing and deserializing a business object, expanding on your examples:
http://www.telerik.com/help/wpf/raddiagram-howto-drag-custom-toolboxitem.html (1)
http://www.telerik.com/help/wpf/raddiagram-extensions-toolbox.html#PopulateWithCustomData (2)

Your examples work just fine (when I changed the geometry handling, because of localization issues, I think).
But when I try to add more properties, and serialize them, I get an error deserializing the objects.

After searching, I have now found this thread:
http://www.telerik.com/forums/adding-my-own-properties-into-settingspane-of-raddiagram-on-selection-of-shape (3)
In this thread, Zarko writes (in September 13th 2012):
...
"As for your second question - unfortunately at the moment the RadDiagram supports only string serialization."

I now have to ask: Is this still the case? I would expect serialization to have been handled way before now.
And if this is the case, how can I get around this? Can you come with a solution so that I can handle what I am trying in my example (see below)?

Thank you very much!



I have the full sample project as png files attached, but here is the issue from my point of view:

namespace DeserializationProblem
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            SerializationService.Default.ItemSerializing += Default_ItemSerializing;
        }

        void Default_ItemSerializing(object sender, SerializationEventArgs<IDiagramItem> e)
        {
            if (e.Entity is RadDiagramShape)
            {
                Geometry g = (e.Entity as RadDiagramShape).Geometry;
                string g_string = GeometryParser.GetString(g);               
                e.SerializationInfo["MyGeometry"] = g_string;
                if ((e.Entity as RadDiagramShape).DataContext is MyShape)
                {
                    e.SerializationInfo["DataContent"] =
                        ((e.Entity as RadDiagramShape).DataContext as MyShape).Header;

                    e.SerializationInfo["DataContent2"] =
                        ((e.Entity as RadDiagramShape).DataContext as MyShape);
                    var test = (MyShape)e.SerializationInfo["DataContent2"];    // <- Works fine
                }
            }
        }

        private void radDiagram1_ShapeDeserialized(object sender, ShapeSerializationRoutedEventArgs e)
        {
            if (e.Shape as RadDiagramShape != null)
            {
                //SerializationInfo e_info = (SerializationInfo)e.SerializationInfo["MyGeometry"];
                string e_info_string = e.SerializationInfo["MyGeometry"].ToString();
                Geometry g = GeometryParser.GetGeometry(e_info_string);               
                (e.Shape as RadDiagramShape).Geometry = g;

                (e.Shape as RadDiagramShape).Content = e.SerializationInfo["DataContent"].ToString(); // <- Works
                var test = (MyShape)e.SerializationInfo["DataContent2"];    // <- Breaks
                // Error: Unable to cast object of type 'System.String' to type 'DeserializationProblem.MyShape'.
                // e.SerializationInfo["DataContent2"] is now a string "DeserializationProblem.MyShape"
            }
        }
    }
}  
 
Martin Ivanov
Telerik team
 answered on 23 Apr 2014
6 answers
165 views
Hello,

I am having some problems on our solution with the IColumnFilterDescriptor.

Here is our C# implementation :

private void searchTextbox_KeyDown(object sender, KeyEventArgs e)
       {
           if (e.Key == Key.Enter) // Enter key pressed
           {
               this.treeListView.FilterDescriptors.Clear();
               var searchTextBox = (TextBox)sender;
 
               if (!string.IsNullOrWhiteSpace(searchTextBox.Text))
               {
                   //this.treeListView.FilterDescriptors.SuspendNotifications();
 
                   if (this.FilterColumns.Count() < 2)
                   {
                       var filterColumn = this.treeListView.Columns[0];
                       filterColumn.ClearFilters();
                       IColumnFilterDescriptor columnDescriptor = filterColumn.ColumnFilterDescriptor;
                       columnDescriptor.FieldFilter.Clear();
 
                       if (!string.IsNullOrWhiteSpace(searchTextBox.Text))
                       {
                           columnDescriptor.SuspendNotifications();
                           columnDescriptor.FieldFilter.Filter1.Operator = FilterOperator.Contains;
                           columnDescriptor.FieldFilter.Filter1.Value = searchTextBox.Text.Trim();
                           columnDescriptor.FieldFilter.Filter1.IsCaseSensitive = false;
 
                           if (columnDescriptor.FieldFilter.Filter2 != null)
                           {
                               columnDescriptor.FieldFilter.Filter2.Operator = FilterOperator.IsNotNull;
                               columnDescriptor.FieldFilter.Filter2.Value = null;
                           }
                           try
                           {
                               columnDescriptor.ResumeNotifications();
                           }
                           catch (ArgumentException) { }
                       }
                   }
                   else
                   {
                       CompositeFilterDescriptor compositeDescriptor = new CompositeFilterDescriptor();
                       compositeDescriptor.LogicalOperator = FilterCompositionLogicalOperator.Or;
                       foreach (var column in this.FilterColumns)
                       {
                           compositeDescriptor.FilterDescriptors.Add(new FilterDescriptor(column,FilterOperator.Contains, searchTextbox.Text, false, typeof(string)));
                       }
 
                       //this.treeListView.FilterDescriptors.SuspendNotifications();
                       this.treeListView.FilterDescriptors.Add(compositeDescriptor);
                       //this.treeListView.FilterDescriptors.ResumeNotifications();
                   }
                   //this.treeListView.FilterDescriptors.ResumeNotifications();
               }
           }
       }

The problem occurs when we in the gridview, we have 2 different item types at the same level. Here is the error we are getting on the columnDescriptor.ResumeNotifications() event :
ArgumentException :
The value "(Empty) AND ((Title Contains ma) AND (Title IsNotNull null))" is not of type "Telerik.Windows.Data.IFilterDescriptor" and cannot be used in this generic collection.
Parameter name: value

We are following the examples shown on your site.
We've been trying to figure out this problem for ours without any success. Any idea where this problem comes from?



ASSYST2 - CGI
Top achievements
Rank 1
 answered on 23 Apr 2014
3 answers
143 views
Hi,

I created a usercontrol base on a ScheduleView. My user control contain a "OnCanDrop" event and a "SetDataSource" method. When I create my UserControl, I fill the view with ReadOnly slots. The user can use the "SetDataSource" method to fill the view with "Appointments" and "SpecialSlots". Appointments is for appointments and SpecialSlots is for open slots where user can drag apointments into it of where user can create new appointments.

My objects (appointments and special slots) contain specifics members for logical purpose.

What I'm trying to do in my a drag and drop behavior, it's to raise my event with the source appointment the user is dragging and the specialslot where the user is trying to drop or drag over so the user can decide if the appointment is trying to drag can be drop or not on the specialslot I raised through my event base on a logic he decided.

If I have an appointment from 8h00 to 8h15 and I want to drag it in the special slot 8h15 to 8h30. I want to raise my event only when I'm over the special slot not after each mouse move of my appointment.

Thank's
Alain
Kalin
Telerik team
 answered on 23 Apr 2014
3 answers
89 views
Hi,

May i know how can i accomplish this pls?

http://clip2net.com/s/7e5IEa

Our requirement is to use car icons as MapPinPoint. I already accomplish that using this code

<br> MapPinPoint pinPoint = new MapPinPoint()<br>                {<br>                    Background = new SolidColorBrush(Colors.Transparent),<br>                    Foreground = new SolidColorBrush(Colors.Transparent),<br>                    FontSize = 14,<br>                    Text = "test" + i ,<br>                    ImageSource = new BitmapImage(new Uri(@"https://cdn4.iconfinder.com/data/icons/aiga-symbol-signs/388/aiga_taxi-32.png", UriKind.Absolute))<br>                };<br><br> this.informationLayer.Items.Add(pinPoint);

Our next requirment is to put a tooltip like popup whenever the user clicks on the icon car. It also has some labels or buttons on the bottom. it must trigger an event like click on the backend whenever clicked. example "Send a message" it will trigger click event of that "send message button" to show a form.


May i ask how is this possible? im having a hardtime doing this. can i have a sample project from you?

THanks





















































Martin Ivanov
Telerik team
 answered on 23 Apr 2014
1 answer
160 views
Can someone please help me set the timeline to show continuous seconds. At the moment it resets to zero every 60 seconds but I need the time line to continue, I.E. 0 to 300 seconds?
Polya
Telerik team
 answered on 23 Apr 2014
1 answer
232 views
Hi,

I used RadCartesianChart with a custom palette and I want to bind the color of the series to the axis. Here is (part of) my XAML:

01.<telerik:RadCartesianChart x:Name="Chart" Palette="{StaticResource ChartPalette}">
02. 
03.    <telerik:RadCartesianChart.SeriesProvider>
04.        <telerik:ChartSeriesProvider Source="{Binding SeriesProvider, ElementName=Control}">
05.            <telerik:ChartSeriesProvider.SeriesDescriptors>
06.                <telerik:CategoricalSeriesDescriptor ItemsSourcePath="ItemsSource" CategoryPath="Time" ValuePath="Value">
07.                    <telerik:CategoricalSeriesDescriptor.Style>
08.                        <Style TargetType="{x:Type telerik:LineSeries}">
09.                            <Style.Triggers>
10.                                <DataTrigger Binding="{Binding UseLogarithmicAxis}" Value="True">
11.                                    <Setter Property="VerticalAxis">
12.                                        <Setter.Value>
13.                                            <telerik:LogarithmicAxis HorizontalLocation="Right" LineStroke="{Binding LogarithmicAxisBrush}" />
14.                                        </Setter.Value>
15.                                    </Setter>
16.                                </DataTrigger>
17.                            </Style.Triggers>
18.                        </Style>
19.                    </telerik:CategoricalSeriesDescriptor.Style>
20.                </telerik:CategoricalSeriesDescriptor>
21.            </telerik:ChartSeriesProvider.SeriesDescriptors>
22.        </telerik:ChartSeriesProvider>
23.    </telerik:RadCartesianChart.SeriesProvider>
24. 
25.    <telerik:RadCartesianChart.HorizontalAxis>
26.        <telerik:DateTimeContinuousAxis />
27.    </telerik:RadCartesianChart.HorizontalAxis>
28.     
29.    <telerik:RadCartesianChart.VerticalAxis>
30.        <telerik:LinearAxis />
31.    </telerik:RadCartesianChart.VerticalAxis>
32. 
33.</telerik:RadCartesianChart>

You can see that on line 13, I used a dependency property LogarithmicAxisBrush, which I will set the value in the code, as a workaround. But I want to bind the color of the series to the axis.

Thank you!
Petar Marchev
Telerik team
 answered on 23 Apr 2014
1 answer
224 views
I want to add a button into the trackball information that is displayed.  I can add a button and it displays but the MouseLeftButtonUp never fires.  Also, in the code behind I cannot access "btnDD" in the example below.  

            <telerik:RadCartesianChart.Behaviors>
                <telerik:ChartTrackBallBehavior ShowTrackInfo="True"
ShowIntersectionPoints="True"
TrackInfoUpdated="ChartTrackBallBehavior_TrackInfoUpdated"/>
            </telerik:RadCartesianChart.Behaviors>


            <telerik:RadCartesianChart.TrackBallInfoStyle>
                <Style TargetType="telerik:TrackBallInfoControl">
                    <Setter Property="HeaderTemplate">
                        <Setter.Value>
                            <DataTemplate>
                                <StackPanel>
                                <TextBlock Text="{Binding}" 
  FontSize="14"
  Foreground="Blue"/>
                                <Button x:Name="btnDD" MouseLeftButtonUp="btnDD_MouseLeftButtonUp">View Files</Button>
                                </StackPanel>
                            </DataTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </telerik:RadCartesianChart.TrackBallInfoStyle>
Petar Marchev
Telerik team
 answered on 23 Apr 2014
5 answers
671 views
I'm trying to use the RadTileView and RadFluidContentControl and I'm getting the error "'Infinity' is not a valid value for property 'Width'." when I change the underlying data that the RadTileView is bound to using ItemSource.

UPDATE: It renders the first time fine and shows the correct tiles bases on the databound collection, but if I change the underlying datasource that is when I receive the error

Any suggestions welcome, cheers.

System.ArgumentException was unhandled
  Message='Infinity' is not a valid value for property 'Width'.
  Source=WindowsBase
  StackTrace:
       at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
       at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
       at System.Windows.FrameworkElement.set_Width(Double value)
       at Telerik.Windows.Controls.RadTileView.AnimateItemSize(RadTileViewItem item, Size targetSize) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\Navigation\TileView\RadTileView.cs:line 927
       at Telerik.Windows.Controls.RadTileView.<AnimateItemSizes>b__29(RadTileViewItem c) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\Navigation\TileView\RadTileView.cs:line 1060
       at System.Collections.Generic.List`1.ForEach(Action`1 action)
Zarko
Telerik team
 answered on 22 Apr 2014
1 answer
126 views
Hi there,

is there a way to not have "LoadLayout" load everything at once but in a sequential way one pane after the other has finished? My Problem is that my application can host many different types of views in a dock manager and some of those views are quite complex. Loading them alone has quite good performance but when the app deserializes the layout and 10 or more panes are created at once, the app hangs for some seconds before the views actually start doing something (I designed them to show what they are doing during initialization - like e.g. filling data into a data grid).

The app is using a bound collection of view models in the dock manager (like from the Prism example), which are then translated to views via data templates. That could probably make it complicated to find out when a pane is completely loaded, I guess...

The described problem is not really a showstopper but it would be great if I could make the app startup a little bit smoother since responsiveness is a big topic in todays applications.

Regards,
Marcel 
George
Telerik team
 answered on 22 Apr 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?