Telerik Forums
UI for WPF Forum
1 answer
79 views
I am trying to convert a bit of code from the old RadDragAndDropManager to the new DragDropManager but the documentation is really lacking and I'm having a lot of trouble figuring out what to do.

I just have a simple function that determines whether or not the user can drop a node in a RadTreeView.  I feel like this should be simple to replicate with DragDropManager, but I'm just missing something:

Tree.AddHandler(RadDragAndDropManager.DragQueryEvent, new EventHandler<DragDropQueryEventArgs>(Tree_DragQuery), true);
 
private void Tree_DragQuery(object sender, DragDropQueryEventArgs e)
{
    var targetTvi = e.Options.Destination as RadTreeViewItem;
    var sourceTvi = e.Options.Source as RadTreeViewItem;
 
    if (targetTvi == null || sourceTvi == null)
    {
        return;
    }
 
    if (sourceTvi.DataContext is LayerTviVM && targetTvi.DataContext is LayerTviVM)
    {
        e.QueryResult = true;
    }
    else if (sourceTvi.DataContext is ImageTviVM && targetTvi.DataContext is ImageTviVM)
    {
        // We only support drag & drop of images within the same layer
        e.QueryResult = (sourceTvi.ParentItem == targetTvi.ParentItem);
    }
    else
    {
        e.QueryResult = false;
    }
}
Yoan
Telerik team
 answered on 24 May 2013
1 answer
93 views
First off, I am on version 2010.3.1314.35 and cannot upgrade at this time.  When using a GridView with a column bound to a

System.Nullable<double> property, I have a couple issues.  One issue is that it allows the user to type anything in the field.  Not just decimal numbers.  I tried to solve this by using cell validating, but when I type a character and tab out of the field, before validating fires it tries to update the bound item (2 way binding is on) and throws a format exception because the character value cannot be put into the double? property. 

The other issue is, since it is nullable, I would also like to allow the user to leave the field blank and it assign null to the bound property.  Is this possible or am I going to have to unbind the column and manually update accordingly?

,
Dimitrina
Telerik team
 answered on 24 May 2013
4 answers
161 views
Hello,

I'm evaluating telerik controls now, and my company will purchase in this month.

I want to know how to save multiple diagram pages with MVVM. (You can see this scenario in a attached screenshot)

Your document and sample is only showing "RadDiagram.Save()" to save a diagram, but my application is generating  a diagram dynamically for each tab content.

In this case, SerializableGraphSource doesn't know what diagram is connected with it.
And a diagram instance will be destroyed and recreated when tab control selection is changed.

Should I make my own save/load functions for this? 
I would appreciate if you give me some advice.

Thank you.
Hyunho
Top achievements
Rank 1
 answered on 24 May 2013
1 answer
130 views
Hi,
Is it possible to center and zoom in the diagram to a particular shape?

I've been trying to use a shape's Position as a parameter in the Diagram's ZoomIn() function, but it's not working as expected. When I first zoom to a shape, that shape is correctly centered in view. Subsequent zooms to other shapes don't work as well - the view is completely off. I guess ZoomIn() doesn't use the same coordinate system as Diagram Shapes, so the Position is something different at different zoom levels.

Maybe there's a "FocusOnShape()" function that I haven't yet found?
Vivek
Top achievements
Rank 1
 answered on 23 May 2013
2 answers
199 views
I have a Cartesian chart as follows:

<telerik:RadCartesianChart x:Name="chart" Grid.Column="0">
    <telerik:RadCartesianChart.Series>
        <telerik:BarSeries ItemsSource="{Binding DataItems}" ValueBinding="Value" CategoryBinding="DayPeriod" >
            <telerik:BarSeries.PointTemplate>
                <DataTemplate>
                    <Rectangle Fill="{Binding Converter={StaticResource BrushConverter}, ConverterParameter={StaticResource brushes}}"/>
                </DataTemplate>
            </telerik:BarSeries.PointTemplate>
        </telerik:BarSeries>
    </telerik:RadCartesianChart.Series>
    <telerik:RadCartesianChart.VerticalAxis>
        <telerik:LinearAxis Minimum="{Binding MinValue}" Maximum="{Binding MaxValue}" MajorStep="{Binding StepSize}" LabelStyle="{StaticResource axisLabelStyle}" />
    </telerik:RadCartesianChart.VerticalAxis>
    <telerik:RadCartesianChart.HorizontalAxis>
        <telerik:CategoricalAxis LabelFitMode="Rotate" LabelInterval="2"/>
    </telerik:RadCartesianChart.HorizontalAxis>
</telerik:RadCartesianChart>

I'm setting the colour of each individual Bar in the BarSeries via an IValueConverter (blue for positive, red for negative) using a BrushCollection defined in the UserControl's resources passed into the Value Converted.
It works very nicely!
The Chart is bount to an ObservableCollection<t> of items implemention INotofyPropertyChanged. When the values change, the graph does indeed update - but it never calls the Color Converter and it the value goes from - to + or the other way around it ends up with the wrong colour.

I can't see how to force this update. Is there a way?

Thanks -



svs
Top achievements
Rank 1
 answered on 23 May 2013
6 answers
635 views
Hello Telerik,


How could I make the resizing of the diagram shapes keep the aspect ratio?

Thanks in advance,
Metanous
Davide
Top achievements
Rank 1
 answered on 23 May 2013
3 answers
183 views
In my MVVM application, there is a RadTimeBar hosting a RadAreaSparkline to give the user an overview of the data.  When a period of time is selected, the SelectionStart and SelectionEnd values are used to query a detailed set of data that is then displayed in a RadTimeline.

After the selection is made, I would like the RadTimeline to have its PeriodStart/End set to match the SelectionStart/End times of the RadTimeBar.  This functionality is working.

At the same time that the RadTimeline has its PeriodStart/End set, I would like to set its VisiblePeriodStart/End to change to show the whole period.  Once this has been done, however, the user should be able to zoom the RadTimeline as normal.

The properties for the RadTimeBar and RadTimeline are bound to properties on my ViewModel.  However, what ends up happening is that after changing the PeriodStart/End, my changes to VisiblePeriodStart/End are overridden in TimeBarBase.CoerceVisiblePeriod(), as my calls to set VisiblePeriodStartart/End are being done before the PeriodStart/End DependencyProperty have been properly updated.

So what ends up happening is that sometimes I get what I want: i.e.VisiblePeriodStart/End being the same as PeriodStart/End, but other times, VisiblePeriodStart/End are set to the PREVIOUS values of PeriodStart/End.

Is there a proper set of steps that I am missing to make this work?

Thanks for your help

Tsvetie
Telerik team
 answered on 23 May 2013
3 answers
194 views
Hi there,

my problem is I have a grid view, and I have tons of login in xaml which perform the grouping and aggregate function, some of the group header/footer may have a DataTemplate to host the data. When I export the grid using the native Export function, I have the following issue:

1. I lost the Group Header, the column I am used to group is not shown in UI and I disallow use to change the grouping
2. I lost the ColumnGroups
3. Some of the cell is incorrect datatype (e.g. number and was interpreted as date in Excel)
4. All the template data cannot be displayed, and what's generated is the datatype instead of the string value on the grid (same as copy from the grid directly using Ctrl-C)

Any help will be appreciated!

Here are some examples of the xaml:

1. Grid Definition
<telerik:RadGridView Name="GridViewMyGrid"                                          
     ItemsSource="{Binding MyCollection}" 
     AutoGenerateColumns="False" 
     IsReadOnly="True"
     CanUserFreezeColumns="False"
     GroupRenderMode="Flat"
     ShowColumnFooters="True"
     ShowGroupFooters="True"
     AutoExpandGroups="True"
     IsFilteringAllowed="False"
     ShowGroupPanel="False" 
     FrozenColumnCount="2" 
     SelectionMode="Extended" 
     >

2. Column Group
<telerik:RadGridView.ColumnGroups>
    <telerik:GridViewColumnGroup  Name="Group1ColumnGroup" 
                            Header="Group1">
        <telerik:GridViewColumnGroup.HeaderTemplate>
            <DataTemplate>
                <TextBlock Text="Group1" 
                        TextAlignment="Center" 
                        FontWeight="Bold"></TextBlock>
            </DataTemplate>
        </telerik:GridViewColumnGroup.HeaderTemplate>
    </telerik:GridViewColumnGroup>


3. Column (I have tons of column and just show two here, the 1st is used for grouping)
<telerik:RadGridView.Columns>                            
    <telerik:GridViewDataColumn DataMemberBinding="{Binding GroupName}" ShowColumnWhenGrouped="False" />
    <telerik:GridViewDataColumn Header="Item1"
                                DataMemberBinding="{Binding Item1}">                            
        <telerik:GridViewDataColumn.AggregateFunctions>
            <telerik:FirstFunction/>
        </telerik:GridViewDataColumn.AggregateFunctions>
        <telerik:GridViewDataColumn.GroupFooterTemplate>
            <DataTemplate>
                <TextBlock FontWeight="Bold">
                    <Run Text="Subtotal "/>
                    <Run Text="{Binding Value.GroupName}"/>
                </TextBlock>                                        
            </DataTemplate>
        </telerik:GridViewDataColumn.GroupFooterTemplate>
        <telerik:GridViewColumn.Footer>
            <TextBlock FontWeight="Bold">
                <Run Text="Asset Total"/>
            </TextBlock>
        </telerik:GridViewColumn.Footer>
    </telerik:GridViewDataColumn>


And here is the method in the code behind to export:

 

private void ButtonExportStrats_OnClick(object sender, RoutedEventArgs e)
{
    var grid = GridViewMyGrid;            
    var dialog = new SaveFileDialog();
    dialog.DefaultExt = "*.xlsx";
    dialog.Filter = "Excel Workbook (*.xlsx)|*.xlsx";
    if (dialog.ShowDialog() == true)
    {
        Workbook book = null;
        using (var stream = new MemoryStream())
        {
            grid.Export(stream, new GridViewExportOptions()
            {
                Format = ExportFormat.Csv,
                ShowColumnFooters = grid.ShowColumnFooters,
                ShowColumnHeaders = grid.ShowColumnHeaders,
                ShowGroupFooters = grid.ShowGroupFooters
            });
            stream.Position = 0;
            book = new CsvFormatProvider().Import(stream);
            if (book != null)
            {
                var provider = new XlsxFormatProvider();
                using (var output = dialog.OpenFile())
                {
                    provider.Export(book, output);
                }
            }
        }
    }
}
Yoan
Telerik team
 answered on 23 May 2013
4 answers
281 views
Hi,

I tested the code of samples "Paint with MVVM".
All works good but how to add sub Items to a DropDownsButton?
I tryed a lot of strategies without success...

Thank's,
marc.
Pavel R. Pavlov
Telerik team
 answered on 23 May 2013
3 answers
351 views
Is it possible to use this control with MVVM?  I don't think it's possible but figured I would ask the experts.  Thanks.
Zarko
Telerik team
 answered on 23 May 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?