Telerik Forums
UI for WPF Forum
3 answers
163 views

Hi,

When I try to select C:\ drive as the destination folder (a.k.a FileName property) in RadOpenFolderDialog, it gets set to the location of the application it's running.

This only happens for C:\ drive and no other drives (e.g. D:\) or the subfolders in C:\ drive (e.g. C:\path).

Also, when I select C from "This PC", the destination correctly gets set to C (first attached file), but when when I select C while in C drive it gets incorrectly set (second attached file).

 

Is there any known issue about this?

Vladimir Stoyanov
Telerik team
 answered on 25 Mar 2020
4 answers
204 views

To make entire tile area draggable, I applied following behavior on RadTileView-

<telerik:RadTileView  IsItemsAnimationEnabled="False"  x:Name="myTileView"
                             ItemsSource="{Binding AvailableChartList,UpdateSourceTrigger=Explicit}" 
                             telerik:RadTileView.ItemContainerStyle="{DynamicResource RadTileViewItemStyle1}"                                  
                             MaximizeMode="Zero">
                    <i:Interaction.Behaviors>
                        <local:RadTilesDragDropBehavior/>
                    </i:Interaction.Behaviors>
</telerik:RadTileView>

-----Behavior------

public class RadTilesDragDropBehavior : Behavior<RadTileView>
{
    private int DragedElementInitialPosition;
    private bool isDragging;
    private int endPosition = -1;
    private RadTileViewItem dragElement;
    protected override void OnAttached()
    {
        base.OnAttached();
        // Insert code that you would want run when the Behavior is attached to an object.        
        DragDropManager.AddDragInitializeHandler(AssociatedObject, OnDragInitialize);
        DragDropManager.AddDragDropCompletedHandler(AssociatedObject, OnDragAndDropCompleted);
        AssociatedObject.PreviewDragOver += MyTileView_PreviewDragOver;
        AssociatedObject.PreviewTilePositionChanged += RadTileView_PreviewTilePositionChanged;
    }
    private void RadTileView_PreviewTilePositionChanged(object sender, Telerik.Windows.RadRoutedEventArgs e)
    {
        if (this.isDragging)
        {
            e.Handled = true;
            var container = e.OriginalSource as RadTileViewItem;
            if (container == this.dragElement)
            {
                this.endPosition = container.Position;
            }
        }
    }
   
    private void OnDragInitialize(object sender, DragInitializeEventArgs args)
    {
        this.isDragging = true;
        var tileView = sender as RadTileView;
        var tileViewItem = args.OriginalSource as RadTileViewItem;
        this.dragElement = tileViewItem;
        this.DragedElementInitialPosition = dragElement.Position;
       
        if (tileViewItem != null && tileView != null)
        {
            args.Data = tileViewItem;
            var draggingItem = new RadTileViewItem
            {
                Style=AssociatedObject.Resources["RadTileViewItemStyle1"] as Style,
                Width = tileViewItem.RestoredWidth,
                Height = tileViewItem.RestoredHeight
            };

            args.DragVisual = draggingItem;
           tileViewItem.Opacity = 100;
           args.AllowedEffects = DragDropEffects.Move;
            args.Handled = true;        
        }
    }

    private void OnDragAndDropCompleted(object sender, DragDropCompletedEventArgs args)
    {
        if (args.OriginalSource.GetType() == typeof(RadTileViewItem))
        {
            this.isDragging = false;
                Point pt = Util.CorrectGetPosition((RadTileView)sender);
                HitTestResult result = VisualTreeHelper.HitTest(AssociatedObject, pt);
                if (result != null)
                {
                    DependencyObject obj = result.VisualHit.ParentOfType<RadTileViewItem>();
                    if (obj != null)
                    {
                        endPosition=((RadTileViewItem)obj).Position;
                        RadTileView parent = args.Source as RadTileView;

                        IEnumerable<RadTileViewItem> itemsToMove = null;

                        if (this.endPosition != -1)
                        {
                            if (this.DragedElementInitialPosition < this.endPosition)
                            {
                                var itemsCollection = ((IList<ChartDetail>)parent.ItemsSource);
                                itemsToMove = itemsCollection
                                     .Select(i => parent.ItemContainerGenerator.ContainerFromItem(i) as RadTileViewItem)
                                     .Where(c => c.Position > this.DragedElementInitialPosition && c.Position <= this.endPosition)
                                     .OrderBy(c => c.Position);

                                foreach (var item in itemsToMove)
                                {
                                    item.Position--;
                                }
                            }
                            else
                            {
                                for (int i = 0; i < this.DragedElementInitialPosition - this.endPosition; i++)
                                {
                                    this.dragElement.Position--;
                                }
                            }
                        }

                        this.endPosition = -1;
                      }
                    else
                    {
                        draggingTile.Opacity = 100;
                    }
                }
                else
                {
                    draggingTile.Opacity = 100;
                }
            }
       }
    
    private void MyTileView_PreviewDragOver(object sender, System.Windows.DragEventArgs e)
    {
        FrameworkElement container = sender as FrameworkElement;
       
            if (container == null)
            {
                return;
            }
            double tolerance = 60;
            double verticalPos = Util.CorrectGetPosition((RadTileView)container).Y;
            double offset = 20;
            ScrollViewer scrollViewer = AssociatedObject.FindChildByType<ScrollViewer>();
            if (verticalPos < tolerance) // Top of visible list?             
            {
                scrollViewer.ScrollToVerticalOffset(scrollViewer.VerticalOffset - offset); //Scroll up.             
            }
            else if (verticalPos > container.ActualHeight - tolerance) //Bottom of visible list?             
            {
                scrollViewer.ScrollToVerticalOffset(scrollViewer.VerticalOffset + offset); //Scroll down.                 
            }       
    }

    protected override void OnDetaching()
    {
        base.OnDetaching();
        // Insert code that you would want run when the Behavior is removed from an object.      
        DragDropManager.RemoveDragInitializeHandler(AssociatedObject, OnDragInitialize);
        DragDropManager.RemoveDragDropCompletedHandler(AssociatedObject, OnDragAndDropCompleted);
        AssociatedObject.PreviewDragOver -= MyTileView_PreviewDragOver;
        AssociatedObject.PreviewTilePositionChanged -= RadTileView_PreviewTilePositionChanged;
    }

}

If I drag Tile By clicking anywhere on the tile and drop anywhere on the RadTileView, it works fine.

But If I try to drag the Tile by clicking on the header area(RadTileViewItem's default draggable area) and drop the tile out of RadTileView, Tile vanishes from the view. (Please refer the attached image to see the issue.)

Please, suggest a way to fix this issue or if there is any other way to make entire tile draggable.

 

 

Dinko | Tech Support Engineer
Telerik team
 answered on 25 Mar 2020
1 answer
355 views

Hello,

I have some problem with Export to Excel for DateTime Format Columns.

Set Column Format:

(this.myGrid.Columns["JPr_MinStart"] as GridViewDataColumn).DataFormatString = "dd/MM/yyyy hh:mm";

 

On ElementExportingToDocument:

01.private void myGrid_ElementExportingToDocument(object sender, GridViewElementExportingToDocumentEventArgs e)
02.{
03.    if (e.Element == ExportElement.Cell)
04.    {
05.        var cellExportingArgs = e as GridViewCellExportingEventArgs;
06.        if (
07.            (cellExportingArgs.Column as GridViewDataColumn).UniqueName == "JPr_MinStart"
08.        )
09.        {
10.            (cellExportingArgs.Column as GridViewDataColumn).DataFormatString = string.Empty;
11.            var parameters = cellExportingArgs.VisualParameters as GridViewDocumentVisualExportParameters;
12.            parameters.Style = new CellSelectionStyle()
13.            {
14.                Format = new CellValueFormat("dd/MM/yyyy hh:mm")
15.            };
16.        }
17.    }
18.}

On ElementExportedToDocument

private void myGrid_ElementExportedToDocument(object sender, GridViewElementExportedToDocumentEventArgs e)
 {
         if (e.Element == ExportElement.Table)
{
      (this.myGrid.Columns["JPr_MinStart"] as GridViewDataColumn).DataFormatString = "dd/MM/yyyy hh:mm";
}
 }

 

If I set DateFormatString, the export to Excel is wrong. It export the value as String and Excel cannot recognize the DateTime column.

If i remove DateFormatString on Exporting and on Exported I set the DateFormat string, the Excel is right but the first line no!

 

I think that is a bug? My WPF version is: 2018.1.220.40

Thank you very much

Martin Ivanov
Telerik team
 answered on 24 Mar 2020
1 answer
75 views
When we click the pin button we expect to see all the panes in the group hidden or pinned.  Instead we are seeing the individual panes being pinned or unpinned.  Is there a way to override this functionality?
Vladimir Stoyanov
Telerik team
 answered on 24 Mar 2020
1 answer
202 views
I want the first column to be the row header, or some way of defining the row header.  I'm auto generating the columns because I have a dynamic number of columns.  Any ideas?
Vladimir Stoyanov
Telerik team
 answered on 24 Mar 2020
6 answers
417 views
Hello,

i want to remove all Styles from the StyleRepository of the current RadDocument and add my own StyleDefinitions.

The adding of StyleDefinitions works fine, but I can't remove the standard Style.
I tried it with
editor.Document.StyleRepository.Clear();
or
foreach (var style in editor.Document.StyleRepository)
editor.Document.StyleRepository.Remove(style);
or
foreach (var style in editor.Document.StyleRepository)
style.IsPrimary = false;

But allways threre are more Styles than my own in the StyleGallery.
Dimitar
Telerik team
 answered on 24 Mar 2020
2 answers
112 views

Hi,

In 001.png,how to change the background of the cells when I press and hold the mouseleftbutton?

the selectionUnit is cell,and the selectionMode is extended.

guo
Top achievements
Rank 1
 answered on 24 Mar 2020
3 answers
83 views

Hello.

I need directly selected the path like 'DeskTop', 'Videos' or other in the custom place pane sometimes in my application.

Is there has a way to return the selected custom place path in custom place pane?

Martin Ivanov
Telerik team
 answered on 23 Mar 2020
4 answers
261 views

Hello,

MergedCellsStyle of my RadGridView is below.I want to chenge the background of the mergedCell when it is selected.But the code dose not work.

How to achieve that?

Thanks.

<Style x:Key="GridViewMergedCell1" TargetType="telerik:GridViewMergedCell" >
            <Setter Property="ContentTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <StackPanel>
                            <TextBlock Text="{Binding}" Foreground="Black" HorizontalAlignment="Center" VerticalAlignment="Center" FontWeight="Bold"/>
                        </StackPanel>
                    </DataTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="Background" Value="AliceBlue"/>
            <Style.Triggers>
                <Trigger Property="IsSelected" Value="True">
                    <Setter Property="Background" Value="AliceBlue"/>
                </Trigger>
            </Style.Triggers>
        </Style>
Vladimir Stoyanov
Telerik team
 answered on 19 Mar 2020
3 answers
306 views

I'm trying to only allow users to type in 6 digits integer with prefix "CA", and now I can only type in one leading zero, not multiple zeros. 

Here is my code, and ProjectNumber is a nullable double. 

<telerik:RadMaskedNumericInput                     

Grid.Column="0"                   

Margin="25, 0, 0, 10"                    

Width="100"                   

Mask="CA#####"                   

Placeholder=""                            

AutoFillZeros="False"                   

AutoFillNumberGroupSeparators ="False"                   

IsClearButtonVisible="False"                                       

AllowInvalidValues="True"                   

Validation.ErrorTemplate="{x:Null}"                   

maskedInput:MaskedInputExtensions.Minimum="0"                     

HorizontalContentAlignment="Left"                   

HorizontalAlignment="Left"                                        

Value="{Binding Path=(viewModel:IProjectFolderViewModel.ProjectNumber), Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>

 

Also, the prefix 'CA' only appears after users click on the input box or type in something. is there anyway that we could show the prefix all the time. 

Martin Ivanov
Telerik team
 answered on 19 Mar 2020
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?