Telerik Forums
UI for WPF Forum
1 answer
98 views

I've tried all the options for KeyboardNavigation.TabNavigation and none of them seem to get the desired result. How to enable tabbing through fields of a RadDataForm displayed via a RadGridView row details template?

Thanks ... Ed

 

Stefan Nenchev
Telerik team
 answered on 24 Feb 2017
9 answers
272 views
I have set IsPinned=false in the docking rad pane, but upon load it is showing animation and then hiding it. Is there any way i can disable that animation? I am using RadControls for WPF Q2 2010 version# 2010.2.714.40

Appreciate your help,
Thanks!
Georgi
Telerik team
 answered on 24 Feb 2017
12 answers
1.1K+ views
hi,

1. i have a dock control in a grid, the Height of the the row is set to "auto" and i get an exception:
"Placing Docking control in a panel or control that measures it with infinite width or height is not supported in the current version. You can disable this error by setting the AllowUnsafeMode property of the RadDocking control."

if the Height is set to a number or to " * " it's works fine.
is this behavior normal?

2. one other thing (a small one):
when a pane is set to auto-hide, i place the mouse pointer on it and it shows, 
then when i place the pointer on the top of the pane, 
between the header text and the buttons the pane hides again, a little annoying, i've checked it on another 
computer and this happens again.

thanks in advance,

Lior.


Georgi
Telerik team
 answered on 24 Feb 2017
8 answers
192 views
Hi,

I downloaded the demo code and ran it with Visual Studio 2012 on Windows 7.
When I click on Explore All Controls and then on Radial Menu, this Exception is thrown:

FileNotFoundException
Could not load file or assembly 'Telerik.Windows.Themes.Windows8, Culture=neutral' or one of its dependencies. The system cannot find the file specified.

at this location in the code:
> QuickStart.Common.dll!Telerik.Windows.Controls.QuickStart.Common.Helpers.ApplicationThemeManager.EnsureFrameworkElementResourcesForTheme(System.Windows.FrameworkElement element, string themeName) Line 257 + 0x31 bytes C#

Sebastien
Kalin
Telerik team
 answered on 23 Feb 2017
1 answer
146 views

Hi

 

I've added a button to my RadGridView via the below:

 

Dim col As New MyDeleteButtonColumn()
RadGridView1.Columns.Add(col)

Public Class MyDeleteButtonColumn
Inherits Telerik.Windows.Controls.GridViewColumn
Public Overrides Function CreateCellElement(cell As GridViewCell, dataItem As Object) As FrameworkElement
Dim btn As New RadButton()
btn.Content = "MD"
btn.[AddHandler](Button.ClickEvent, New RoutedEventHandler(AddressOf btn_Click))
Return btn
End Function
Private Sub btn_Click(sender As Object, e As RoutedEventArgs)
     Dim win2 As New form2("gvcell0value:)")
win2.Show()
End Sub

 

Within the but_Click I need to get the value of from cell 0 to pass throught to a new form opening

How could I achive this?

Many thanks

Stefan Nenchev
Telerik team
 answered on 23 Feb 2017
3 answers
278 views

Lets assume that the view is the following:

<Window x:Class="RadGridViewSelectionBug.MainWindow"
        xmlns:local="clr-namespace:RadGridViewSelectionBug"
        mc:Ignorable="d"
        Title="MainWindow" Height="350" Width="525" WindowState="Maximized">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition />
        </Grid.RowDefinitions>
 
        <Button HorizontalAlignment="Left" Click="Button_Click">Click Me</Button>
        <telerik:RadGridView x:Name="radGridView"
                             Grid.Row="1"
                             NewRowPosition="None" 
                             RowIndicatorVisibility="Collapsed"
                             ItemsSource="{Binding DataView}"
                             ShowGroupPanel="False"
                             AutoGenerateColumns="True"
                             IsReadOnly="True"
                             IsFilteringAllowed="False"
                             EnableColumnVirtualization="True"
                             CanUserSortColumns="False"
                             CanUserDeleteRows="False"
                             CanUserInsertRows="False"
                             SelectionMode="Extended"
                             SelectionUnit="Cell"
                             MinColumnWidth="50"
                             CanUserReorderColumns="False"
                             CanUserFreezeColumns="False"
                             GroupRenderMode="Flat"
                             ValidatesOnDataErrors="None"
                             ColumnWidth="75"
                             FrozenColumnCount="1"
                             FrozenColumnsSplitterVisibility="Collapsed"
                             ClipboardCopyMode="Cells"
                             ClipboardPasteMode="Cells"
                             TextBlock.TextAlignment="Center">
        </telerik:RadGridView>
    </Grid>
</Window>

 

The Code behind is the following:

public partial class MainWindow : Window
{
    public MainWindow()
    {
        InitializeComponent();
        this.DataContext = new MainViewModel();
        radGridView.SelectedCellsChanged += RadGridView_SelectedCellsChanged;
    }
 
    private void RadGridView_SelectedCellsChanged(object sender, Telerik.Windows.Controls.GridView.GridViewSelectedCellsChangedEventArgs e)
    {
        var selectedCells = (sender as RadGridView).SelectedCells.Where(c => c != null).ToList();
 
        if (selectedCells.Any())
        {
            var firstCell = selectedCells.First();
            var lastCell = selectedCells.Last();
 
            int fromRowIndex = firstCell.Column.DataControl.Items.IndexOf(firstCell.Item);
            int fromColIndex = firstCell.Column.DisplayIndex;
 
            int toRowIndex = lastCell.Column.DataControl.Items.IndexOf(lastCell.Item);
            int toColIndex = lastCell.Column.DisplayIndex;
 
            Console.WriteLine(string.Format("{0}, {1}, {2}, {3}", fromRowIndex, fromColIndex, toRowIndex, toColIndex));
        }
    }
 
    private void Button_Click(object sender, RoutedEventArgs e)
    {
        (this.DataContext as MainViewModel).RebuildData();
    }
}

 

And the MainViewModel code is:

public class MainViewModel : ViewModelBase
{
    private DataTable _dataTable;
 
    public MainViewModel()
    {
        _dataTable = new DataTable();
        _dataTable.Columns.Add(new DataColumn()
        {
            Caption = "Col1",
            DataType = typeof(int),
        });
        _dataTable.Columns.Add(new DataColumn()
        {
            Caption = "Col2",
            DataType = typeof(int),
        });
        _dataTable.Columns.Add(new DataColumn()
        {
            Caption = "Col3",
            DataType = typeof(int),
        });
 
        for (int i = 0; i <100; i++)
        {
            var row = _dataTable.NewRow();
            for (int j = 0; j < 3; j++)
            {
                row[j] = 0;
            }
            _dataTable.Rows.Add(row);
        }
    }
 
    internal void RebuildData()
    {
        var dataTable = new DataTable();
        dataTable.Columns.Add(new DataColumn()
        {
            Caption = "Col1",
            DataType = typeof(int),
        });
        dataTable.Columns.Add(new DataColumn()
        {
            Caption = "Col2",
            DataType = typeof(int),
        });
        dataTable.Columns.Add(new DataColumn()
        {
            Caption = "Col3",
            DataType = typeof(int),
        });
 
        for (int i = 0; i < 10; i++)
        {
            var row = dataTable.NewRow();
            for (int j = 0; j < 3; j++)
            {
                row[j] = 0;
            }
            dataTable.Rows.Add(row);
        }
 
        DataTable = dataTable;
    }
 
    public DataView DataView
    {
        get
        {
            return _dataTable.DefaultView;
        }
    }
 
    public DataTable DataTable
    {
        get
        {
            return _dataTable;
        }
        set
        {
            _dataTable = value;
            OnPropertyChanged("DataView");
        }
    }
 
}

 

Run the code. Then Press Ctrl + A, in order to select all cells.

Then click on the Button.

 

You should get an exception (The grid view code tries to access a column with index that does not exist).

If I remove the cellInfo null check, and just write:

var selectedCells = (sender as RadGridView).SelectedCells;

Then I'll get that few cells in the SelectedCells are nulls (I might get that the firstCell, or the lastCell are nulls).

 

 

Now for another interesting bug:

Restart the code.

Select the first cell (upper left corner). The code shows Row = 0 and Col = 0 --> Good.

Now Click the button.. The selection is cleared...

Now Select the first cell again. The code shows Row = -1, Col = 0. (WTF?)

Now, any cell that you will select on the first row will give you that result. But if you select a cell from a different row, and then reselect a cell from the first row, then the problem is fixed.

 

 

Btw, getting the Item from the Added cells and checking its row index does give the correct result, but what I'm trying to do is to have the user have only 1 selected region (A rectangle of selected cells), so I can have a from row, from cell, to row, and to cell information.

 

So, in my code, I also clear selection in Grid PreviewMouseLeftButtonDown.

Any other suggestions of having only rectangular selection will be welcome (since right now, clicking on blank area, or clicking the scrollbar also clears the selection).

 

Furthermore, any suggestions on how to get the correct selected region will be welcome.

 

Thanks

BENN
Top achievements
Rank 1
 answered on 23 Feb 2017
1 answer
59 views

My project need insert chart to spreadsheet,and print all content.

I know devexpress control can add chart to spreadsheet.

when the spreadsheet can support the chart

Dinko | Tech Support Engineer
Telerik team
 answered on 23 Feb 2017
2 answers
102 views

Hi to all,

I have a simple grid, that I'm using with MVVM pattern.

<Style x:Key="ListEditableFlatStyle" TargetType="telerik:RadGridView" BasedOn="{StaticResource RadGridViewStyle}">
    <Setter Property="CanUserDeleteRows" Value="True"/>
    <Setter Property="CanUserFreezeColumns" Value="True"/>
    <Setter Property="CanUserInsertRows" Value="True"/>
    <Setter Property="CanUserReorderColumns" Value="False"/>
    <Setter Property="CanUserResizeColumns" Value="True"/>
    <Setter Property="CanUserResizeRows" Value="False"/>
    <Setter Property="CanUserSelect" Value="True"/>
    <Setter Property="CanUserSortColumns" Value="False"/>
    <Setter Property="CanUserSortGroups" Value="False"/>
    <Setter Property="ShowGroupPanel" Value="False"/>
    <Setter Property="ShowSearchPanel" Value="False"/>
    <Setter Property="AutoGenerateColumns" Value="False"/>
    <Setter Property="IsReadOnly" Value="False"/>
    <Setter Property="SelectionMode" Value="Extended"/>
    <Setter Property="SelectionUnit" Value="FullRow"/>
    <Setter Property="IsLocalizationLanguageRespected" Value="False"/>
    <Setter Property="Margin" Value="2"/>
    <Setter Property="NewRowPosition" Value="Bottom"/>
    <Setter Property="GroupRenderMode" Value="Flat"/>
</Style>
 
<telerik:RadGridView ItemsSource="{Binding MisureModelli}" Style="{StaticResource ListEditableFlatStyle}"
                     GroupRenderMode="Flat"
                     Grid.Row="6" Grid.ColumnSpan="4">
    <telerik:RadGridView.Columns>
        <telerik:GridViewDataColumn DataMemberBinding="{Binding PesoLordo, StringFormat=\{0:N2\}}" Header="Peso Lordo (Kg)" HeaderTextAlignment="Right"
                        TextAlignment="Right"/>
        <telerik:GridViewDataColumn DataMemberBinding="{Binding PesoNetto, StringFormat=\{0:N2\}}" Header="Peso Netto (Kg)" HeaderTextAlignment="Right"
                        TextAlignment="Right"/>
        <telerik:GridViewDataColumn DataMemberBinding="{Binding Volume, StringFormat=\{0:N3\}}" Header="Volume (m³)" HeaderTextAlignment="Right"
                        TextAlignment="Right" IsReadOnly="True"/>
    </telerik:RadGridView.Columns>
</telerik:RadGridView>

 

When I click "new row", it disappears exists row, I don't undestrand why.

Dario Concilio
Top achievements
Rank 2
 answered on 23 Feb 2017
1 answer
382 views

Dear Forum Members ,

 

I have a requirement to copy paste the Excel content to Radgrid view , Here few of the columns of the grid are Read only , i tried out the Below options , Any suggestions appreciated .

In Rad gridview is set the below properties

ClipboardCopyMode="Cells" ClipboardPasteMode="AllSelectedCells,Cells" SelectionMode="Extended" SelectionUnit="Cell"

 

and in the behaviour have the PastingCellClipboardContent event to check on the data and map it accordingly , issue here is that for read-only columns this is not fired , please do suggest

 

regards
Anand

 

Stefan Nenchev
Telerik team
 answered on 23 Feb 2017
1 answer
75 views

Hi, I inputted a table onto my document with 1 row and 2 columns.

I then inputted a Custom Merge Field in column 2. My Custom Merge field inputs a table. Code is below

protected override DocumentFragment GetResultFragment()
{
    UniversalDTO universalDTO = this.Document.MailMergeDataSource.CurrentItem as UniversalDTO;
    if (universalDTO == null)
    {
        return null;
    }
 
    if (this.PropertyPath == "Collaterals")
    {
        Table table = new Table();
 
 
        foreach (var coillateral in universalDTO.Collaterals)
        {
            Span span = new Span(coillateral.Type.Value);
            span.FontSize = 11.5;
            Paragraph paragraph = new Paragraph();
            paragraph.Inlines.Add(span);
 
            Span span2 = new Span(coillateral.Description);
            span2.FontSize = 11.5;
            Paragraph paragraph2 = new Paragraph();
            paragraph2.Inlines.Add(span2);
 
            TableCell cell = new TableCell();
            cell.Blocks.Add(paragraph);
            cell.Borders = new TableCellBorders(new Border(1, BorderStyle.Single, Colors.Transparent));
 
            TableCell cell2 = new TableCell();
            cell2.Blocks.Add(paragraph2);
            cell2.Borders = new TableCellBorders(new Border(1, BorderStyle.Single, Colors.Transparent));
 
            TableRow row = new TableRow();
            row.Cells.Add(cell);
            row.Cells.Add(cell2);
            table.AddRow(row);
        }
 
        Section section = new Section();
        section.Blocks.Add(table);
 
        RadDocument document = new RadDocument();
        document.Sections.Add(section);
 
        document.MeasureAndArrangeInDefaultSize();
        return new DocumentFragment(document);
    }
 
    return null;
}

 

The issue I'm having is depicted by the image below, there's a space ontop of the nested table. If tried to delete in the document, it deletes the table. That empty line can be deleted in word though.

http://imgur.com/cf22ee44-9cdd-4840-b045-a9500c8d0569

 

Code View 

 

http://imgur.com/LQirves

band
Top achievements
Rank 1
 answered on 22 Feb 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?