Telerik Forums
UI for WPF Forum
4 answers
158 views

Hi to all,

I would avoid ovelap between RadDiagramShapes (all rectangle items).

When I set IsSnapToGridEnabled="False" IsSnapToItemsEnabled="true" and move RadDiagramShapes, SnappingEngine uses snap on myshape aligned to other ractangle.

If I try to user MyMovedShaped.Bounds.Rect.IntersectWith(OtherRectangleShape) returns me ever True.

I'm using this code:

01.private void topRadDiagram_Drag(object sender, DragRoutedEventArgs e)
02.{
03.    var diagram = (RadDiagram)sender;
04. 
05.    foreach (var item in e.Items)
06.    {
07.        var currentItem = (RadDiagramShape)item;
08. 
09.        var shapeItem = (GruppoPianoDiCarico)currentItem.Tag;
10. 
11.        foreach (RadDiagramShape otherItems in diagram.Items)
12.        {
13.            if (otherItems.Tag.GetType() == typeof(GruppoPianoDiCarico))
14.            {
15.                var shapeOther = (GruppoPianoDiCarico)otherItems.Tag;
16. 
17.                if (shapeItem != shapeOther)
18.                {
19.                    if (currentItem.Bounds.IntersectsWith(otherItems.Bounds))
20.                    {
21.                        //Da ripristinare le coordinate originarie
22.                        currentItem.Position = new Point(currentItem.Position.X - (e.MousePosition.X - e.StartMousePosition.X),
23.                            currentItem.Position.Y - (e.MousePosition.Y - e.StartMousePosition.Y));
24.                    }
25.                }
26.            }
27.        }
28.    }
29.}

 

Petar Mladenov
Telerik team
 answered on 02 Jun 2017
2 answers
154 views

Hi. i use RadGridView including FilteringMode is FilterRow.

in this case, How to delete the filter Control? I want to use only default FilterRow function.

and  can i delete only Header Part in FilterRow?

 

If it is possible, Please give the solution, and Example Code. (Please Do not remark about 'ShowSearchPanel = true', I want to know only about FilterRow.)

 

Thanks

 

Dilyan Traykov
Telerik team
 answered on 02 Jun 2017
1 answer
180 views

I have a MVVM setup with GraphSource etc. as described in this example: http://docs.telerik.com/devtools/wpf/controls/raddiagram/populating-with-data/data-databinding

When I delete a node, the connecting edges are not getting deleted. I see this working in various other examples, but for me, the edges remain on the diagram. I found an old post from 2013 about this functionality not working, but I expect that in 2017, that bug has been fixed: http://www.telerik.com/forums/remove-connections-when-removing-node

Before I post more (code) details: Is the behavior expected to work? If yes, what's a good way to debug why edges are not getting correctly deleted for me?

Dinko | Tech Support Engineer
Telerik team
 answered on 02 Jun 2017
1 answer
76 views

I'm trying to drag&drop from my radlistbox that has ItemSource with my Collection (by MVVM)

I valued RadDiagramShape.Tag property with my object, I would to send this one also.

But into ItemsChanged event I found Tag = null.

How can I do this?

DragDropManager.AddDragInitializeHandler(MacchineDaCaricareRadListBox, OnDragInitialize);
 
private void OnDragInitialize(object sender, DragInitializeEventArgs args)
{
    args.AllowedEffects = DragDropEffects.All;
 
    //RadDiagramShape draggedShape = (args.OriginalSource as ListBoxItem).Content as RadDiagramShape;
    GruppoPianoDiCarico pallet = (args.OriginalSource as RadListBox).SelectedValue as GruppoPianoDiCarico;
 
    RadDiagramShape macchina = new RadDiagramShape()
    {
        Width = pallet.Lunghezza / SCALE,
        Height = pallet.Larghezza / SCALE,
        Content = $"[{pallet.NumeroRiga}] {pallet.Description.ToUpper()}",
        Tag = pallet
    };
    macchina.Geometry = ShapeFactory.GetShapeGeometry(CommonShapeType.RectangleShape);
    macchina.Background = IMBALLO;
    macchina.Foreground = IMBALLO_TITLE;
    macchina.FontWeight = FontWeights.Bold;
    macchina.Stroke = Brushes.Black;
    macchina.StrokeThickness = 1;
    macchina.StrokeDashArray = new DoubleCollection(new Double[] { 5, 1 });
    macchina.FontSize = 20;
 
    List<RadDiagramShape> shapes = new List<RadDiagramShape>();
    shapes.Add(macchina);
    SerializationInfo serializaedInfo = SerializationService.Default.SerializeItems(shapes);
    args.Data = serializaedInfo;
}

 

private void topRadDiagram_ItemsChanged(object sender, DiagramItemsChangedEventArgs e)
{
    [...]

if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add)
{
foreach (var item in e.NewItems)
{
var currenItem = (RadDiagramShape)item;

//it founds Tag = null!!!!
if (currenItem.Tag.GetType() == typeof(GruppoPianoDiCarico))
{
var macchina = (GruppoPianoDiCarico)currenItem.Tag;

vm.MacchineDaCaricare.Remove(macchina);
vm.MacchineCaricate.Add(macchina);
}
}
}
}

Petar Mladenov
Telerik team
 answered on 02 Jun 2017
9 answers
107 views

Is it possible for the sparkline points to have unique tooltips?  I'd like the user to be able to hover over the sparkline and see XValue and YValue in a tooltip.

 

Thanks,

Bryan
Top achievements
Rank 1
 answered on 01 Jun 2017
2 answers
1.0K+ views

I am trying to make some gridview pannel.

I want to make fixed GridView width in the windows. like p1.png. but it can'not be stretched dynamically.

bacause p1.png is made as fixing width in the xaml code (like grid Width="1200" in grid, and my original window width is also 1200). but i don't want to fix width like this.

so i change the code like Width="*" in grid. then gridview pannel can be p2.png.

It shift all panel in window. I don't want it.

How to make fixed gridview Width on the window and can be dynamically stretched.

 

--my code

<Grid HorizontalAlignment="Stretch">
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        
        <telerik:RadGridView Name="tradeListPanel" AutoGenerateColumns="False" ItemsSource="{Binding tradeList}" ShowSearchPanel="True" FrozenColumnCount="7"
                             IsReadOnly="True" EnableRowVirtualization="False" EnableColumnVirtualization="False"
                             FontSize="12" telerikControls:StyleManager.Theme="Summer"
                             ShowColumnFooters ="True" RowIndicatorVisibility ="Collapsed"
                             IsSynchronizedWithCurrentItem ="True" RowDetailsVisibilityMode="VisibleWhenSelected" 
                             Margin="0,0,0,0" Padding="0,0,0,0">

            <telerik:RadContextMenu.ContextMenu>
                <telerik:RadContextMenu x:Name="GridContextMenu" 
                                    ItemContainerStyle="{StaticResource MenuItemContainerStyle}"
                                    Opened="GridContextMenu_Opened"
                                    ItemClick="GridContextMenu_ItemClick"
                                    />
            </telerik:RadContextMenu.ContextMenu>

            <telerik:RadGridView.ControlPanelItems>
                <telerik:ControlPanelItem ButtonTooltip="Column chooser">
                    <telerik:ControlPanelItem.Content >
                        <ListBox ItemsSource="{Binding Columns}" BorderThickness="0">
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <CheckBox Content="{Binding Header, Mode=OneWay}" IsChecked="{Binding IsVisible, Mode=TwoWay}" />
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>
                    </telerik:ControlPanelItem.Content>

.................

................

</telerik:RadGridView>
    </Grid>

 

Thank you.

 

 

 

 

 

 

Dilyan Traykov
Telerik team
 answered on 01 Jun 2017
3 answers
268 views

Hi Telerik,

 

We are using a RadGridView bound to an ObservableCollection wrapped in a CollectionViewSource. Sorting a large number of rows seems to be slower than creating a new collection, sorting this collection using LINQ, then rebinding the RadGridView to the collection. We've attempted to use the QueryableCollectionView as the underlying collection source for the RadGridView and the performance is not improved over the CollectionViewSource when sorting (i.e. clicking on a column in the RadGridView to sort asc/desc/none).

Could you please offer suggestions to help speed up sorting performance? We have followed all suggestions in the "Degraded Performance" article for the UI for WPF suite. Please note that we are using proxy types for entities and prefer not to implement or derive from base classes.

For example, is there a WPF version for this article?:

http://www.telerik.com/support/kb/winforms/details/use-custom-comparer-to-speed-up-the-sorting-in-radgridview

 

Kind regards

Stefan
Telerik team
 answered on 01 Jun 2017
3 answers
93 views

Hi,

Is 2nd feature available in GanttView?

* Click in a Selects the row. Deselect all other rows (This one is existing)
* Hold Ctrl and Adds the row to the selection. Remove if already selected (the Addition is existing but the Remove is not)
* Hold Shift and Adds to the selection (This one is also existing)

Regards,

John

Dilyan Traykov
Telerik team
 answered on 01 Jun 2017
1 answer
176 views

Hi,

We are using your RadGridView in a lot of screens.

For the first time, we have to use the full text search (ctrl F) on a grouped gridview.

In our case (300 lines grouped in 6 groups), we are facing of some performance issue (which give the grid unusable for a final user: too slow).

Do you have a recommandation or best practices for the fulltext search ?

 

The problem disapear if we do that : control the lauch of the search after a timer of 300ms.
So, we change the RadGridView property IsSearchingDeferred="True" and add the following code in the code behind of our view (named ContractDocumentsView)

01....
02. 
03.// Constructor of ContractDocumentsView
04.        public ContractDocumentsView(IServiceLocator serviceLocator)
05.        {
06.            InitializeComponent();
07. 
08.            if (DesignerProperties.GetIsInDesignMode(this))
09.            {
10.                return;
11.            }
12. 
13.            // UserActionDelay is DispatcherTimer timer of 300 ms that execute an Action
14.            this.userActionDelay = new UserActionDelay(this.UpdateFilterOnSearchText);
15.            this.documentsGridView.SearchPanelVisibilityChanged += (sender, args) =>
16.            {
17.// We are keeping a var on the telerik GridViewSearchPanel, initialized once when SearchPanelVisibilityChanged
18.                if (this.gridSearchPanel != null)
19.                    return;
20. 
21.                if (args.NewVisibility == Visibility.Visible)
22.                {
23.                    // ChildrenOfType is a method that search in the visual tree children...
24.                    this.gridSearchPanel = this.documentsGridView.ChildrenOfType<GridViewSearchPanel>().First();
25.                    this.gridSearchPanel.PreviewTextInput += SearchViewPanelOnPreviewTextInput;
26.                }
27.            };
28.        }
29. 
30.        private void SearchViewPanelOnPreviewTextInput(object sender1, TextCompositionEventArgs textCompositionEventArgs)
31.        {
32.            this.gridSearchPanel.PreviewTextInput -= SearchViewPanelOnPreviewTextInput;
33.           var searchBox = this.gridSearchPanel.ChildrenOfType<TextBox>().First();
34.            searchBox.TextChanged += SearchTextBox_TextChanged;
35.        }
36. 
37.        private void SearchTextBox_TextChanged(object sender, TextChangedEventArgs e)
38.        {
39.            this.searchText = ((TextBox)e.OriginalSource).Text;
40.            userActionDelay.DoAction();
41.        }
42. 
43.        private void UpdateFilterOnSearchText()
44.        {
45.            var searchViewModel  = this.gridSearchPanel.DataContext as Telerik.Windows.Controls.GridView.SearchPanel.SearchViewModel;
46.            if (searchViewModel != null)
47.            {
48.                searchViewModel.SearchText = this.searchText;
49.            }
50.        }
51. 
52....
Stefan
Telerik team
 answered on 01 Jun 2017
0 answers
121 views

Hello,

I am trying to add row level validation for my RawTableParamView. RadGridView contains observable collection of SingleRow objects. This class extends from prism BindableBase. One of SingleRow properties is BindableDPDataItem which implements INotifyDataErrorInfo interface and checks if NewValue property showed in custom viewCell template is valid. I attach all important files here. Could you tell me how may I achieave row level validation and if its possible cell level validation for custom cell defined in RadGridView. I found your tutorial and git examples but don't understand how to configure RadGridView to look for BindableDPDataItem validation. Could you please show me how modify my code to make it work?

Maciej
Top achievements
Rank 1
 asked on 01 Jun 2017
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?