Telerik Forums
UI for WPF Forum
2 answers
265 views
Hi, 

I'm looking for a way to display week numbers in this field. Is it possible to do this in the current control version?

Thanks,
Sebastiano
Maxime
Top achievements
Rank 1
 answered on 19 Aug 2016
1 answer
246 views

Hi,

I'm trying to print a gridview, I'd like to split the grid over multiple pages given the page height from the print dialog box.  I'm currently adding the grid to a VisualBrush and to a FixedPage.  When I add that to a FixedDocument and print rows are split of multiple pages.  I'm sure there is a simple solution I've not found.  

Thank you in advance.

Darren

Stefan Nenchev
Telerik team
 answered on 19 Aug 2016
3 answers
124 views

Hi , I use mindmap example code, but why the connector doesn't align with element's bottom edge?

Please see the attachment pictures, thanks!

Jonathan
Top achievements
Rank 1
 answered on 19 Aug 2016
4 answers
271 views
Hello,

While comparing TreeView and TreeListView controls, I've found that the out-of-the-box visuals for DragDrop is much more complete for the TreeView than it is for the TreeListView. I've attached two images, the first showing the TreeView's preview, and the second is showing the TreeListView.

I could not find any examples of the TreeListView that would give a preview like "Drop before x..", can this be achieved for the TreeListView? 

Thanks, 
Ryan
Stefan
Telerik team
 answered on 18 Aug 2016
4 answers
709 views

Hello,

I'm now developing a table to edit a List. I have only one problem, i wan't to cancel edit when user change row without saving with a button on the left of the row.

I use RadGridView and i have try this: ActionOnLostFocus="CancelEdit" but it don't work...

<telerik:RadGridView x:Name="MyGrid" MaxHeight="500"
     CellEditEnded="GridConfig_OnCellEditEnded"
     BeginningEdit="EditGrid_BeginningEdit"
    RowLoaded="EditGrid_RowLoaded"
    CanUserFreezeColumns="True"
    EnableColumnVirtualization="False"                                    
    AutoGenerateColumns="False"
     RowEditEnded="GridConfig_OnRowEditEnded"
    ItemsSource= "{Binding ConfigurationList, Mode=OneWay,
     UpdateSourceTrigger=PropertyChanged}">

Stefan Nenchev
Telerik team
 answered on 18 Aug 2016
2 answers
359 views

Is it possible to implement readonly functionality for the RadSpreadsheet control? The protect/unprotect approach seems very slow, taking around 3/4 seconds to protect a Workbook with 2 Worksheets.

I tried to use the ReadOnlyUILayersBuilder approach from this old ticket http://www.telerik.com/forums/protect-cell-or-sheet-in-spreadsheet, but it's still possible to select a cell and drag the value unto other cells.

Fabrice
Top achievements
Rank 1
 answered on 18 Aug 2016
3 answers
438 views

Hi Telerik,

     I have using GridView with some text columns and button column as last one.

     Text's columns are resizable with minimum size declared. Button's column is non-resizable and must stay right-side pinned.

     Additionally, I need prevent horizontal scroll bar appearing.

     So strange behavior is when resize splitter between last text's and button's columns in left direction - text's column narrowing to it's minimum width and after that previous left column do the same.

      Please, suggest how to prevent that? 

 

With regards, Anatoliy

    

Dilyan Traykov
Telerik team
 answered on 18 Aug 2016
8 answers
862 views
Hi,

I am having some issues printing a grid view. The code I use to print is modified from the downloadable example. The issue is that the page orientation is always portrait, and the grid appears rotated 90 degrees on the page no top margin (see attached image, I printed to pdf). Instead, I would like the page in landscape mode, with proper margins. It also appears that if the grid view is wider than the page, new pages are not added, instead the values are cut off.

So, my questions are:
1. How can I change the page orientation when printing the grid view (programmatically)?
2. How can I add margins?
3. How can I print grid views that are wider than a page on multiple pages?

Here is my code:

In my context menu:
//print
MenuItem mprintGridItem = new MenuItem();
mprintGridItem.Header = "Print Grid";
mprintGridItem.Click += TelerikGridPrint;
MainGrid.ContextMenu.Items.Add(mprintGridItem);

my click handler (note, the grid was created completely in code and in the XAML pages constructor, was added to a stack panel as a child.

private void TelerikGridPrint(object sender, object args)
{
  try
  {
    TelerikGridDocumentCreatorModel.Print(telerikResults.GridControl);
  }
  catch (Exception ex)
  {
    Logger.LogError("TelerikGridPrint: " + ex);
  }
}

And my code to print:
public static class TelerikGridDocumentCreatorModel // : DependencyObject, INotifyPropertyChanged
{
  private static Color HeaderBackground = Color.FromArgb(255, 127, 127, 127);
  private static Color RowBackground = Color.FromArgb(255, 251, 247, 255);
  private static Color GroupHeaderBackground = Color.FromArgb(255, 216, 216, 216);
 
  public static void Print(object parameter)
  {
    RadGridView grid = (RadGridView)parameter;
    RadRichTextBox rtb = new RadRichTextBox() { Height = 0 };
 
    rtb.Name = "RadRichTextBox1";
 
    Grid parent = grid.ParentOfType<Grid>();
    if (parent != null && parent.FindName(rtb.Name) == null)
    {
      parent.Children.Add(rtb);
      rtb.ApplyTemplate();
    }
 
    rtb.Dispatcher.BeginInvoke((Action)(() =>
    {
      rtb.Document = CreateDocument(grid);
    }));
 
    PrintSettings pSettings = new PrintSettings();
 
    pSettings.DocumentName = "MyDocument";
    pSettings.PrintMode = PrintMode.Native;
    pSettings.PrintScaling = PrintScaling.None;
 
    rtb.Print(pSettings);
  }
 
  private static RadDocument CreateDocument(RadGridView grid)
  {
    List<GridViewBoundColumnBase> columns = (from c in grid.Columns.OfType<GridViewBoundColumnBase>()
                                             orderby c.DisplayIndex
                                             select c).ToList();
 
    Telerik.Windows.Documents.Model.Table table = new Telerik.Windows.Documents.Model.Table();
 
    RadDocument document = new RadDocument();
    Telerik.Windows.Documents.Model.Section section = new Telerik.Windows.Documents.Model.Section();
    Telerik.Windows.Documents.Model.Paragraph paragraph1 = new Telerik.Windows.Documents.Model.Paragraph();
    Telerik.Windows.Documents.Model.Paragraph paragraph2 = new Telerik.Windows.Documents.Model.Paragraph();
    section.Blocks.Add(paragraph1);
    section.Blocks.Add(table);
    section.Blocks.Add(paragraph2);
    document.Sections.Add(section);
 
    if (grid.ShowColumnHeaders)
    {
      Telerik.Windows.Documents.Model.TableRow headerRow = new Telerik.Windows.Documents.Model.TableRow();
 
      if (grid.GroupDescriptors.Count > 0)
      {
        Telerik.Windows.Documents.Model.TableCell indentCell = new Telerik.Windows.Documents.Model.TableCell();
        indentCell.PreferredWidth = new TableWidthUnit(grid.GroupDescriptors.Count * 20);
        indentCell.Background = HeaderBackground;
        headerRow.Cells.Add(indentCell);
      }
 
      for (int i = 0; i < columns.Count; i++)
      {
        Telerik.Windows.Documents.Model.TableCell cell = new Telerik.Windows.Documents.Model.TableCell();
        cell.Background = HeaderBackground;
        AddCellValue(cell, columns[i].UniqueName);
        cell.PreferredWidth = new TableWidthUnit((float)columns[i].ActualWidth);
        headerRow.Cells.Add(cell);
      }
 
      table.Rows.Add(headerRow);
    }
 
    if (grid.Items.Groups != null)
    {
      for (int i = 0; i < grid.Items.Groups.Count; i++)
      {
        AddGroupRow(table, grid.Items.Groups[i] as QueryableCollectionViewGroup, columns, grid);
      }
    }
    else
    {
      AddDataRows(table, grid.Items, columns, grid);
    }
 
    return document;
  }
 
  private static void AddDataRows(Telerik.Windows.Documents.Model.Table table, IList items, IList<GridViewBoundColumnBase> columns, RadGridView grid)
  {
    for (int i = 0; i < items.Count; i++)
    {
      Telerik.Windows.Documents.Model.TableRow row = new Telerik.Windows.Documents.Model.TableRow();
 
      if (grid.GroupDescriptors.Count > 0)
      {
        Telerik.Windows.Documents.Model.TableCell indentCell = new Telerik.Windows.Documents.Model.TableCell();
        indentCell.PreferredWidth = new TableWidthUnit(grid.GroupDescriptors.Count * 20);
        indentCell.Background = RowBackground;
        row.Cells.Add(indentCell);
      }
 
      for (int j = 0; j < columns.Count; j++)
      {
        Telerik.Windows.Documents.Model.TableCell cell = new Telerik.Windows.Documents.Model.TableCell();
 
        object value = columns[j].GetValueForItem(items[i]);
 
        AddCellValue(cell, value != null ? value.ToString() : string.Empty);
 
        cell.PreferredWidth = new TableWidthUnit((float)columns[j].ActualWidth);
        cell.Background = RowBackground;
 
        row.Cells.Add(cell);
      }
 
      table.Rows.Add(row);
    }
  }
 
  private static void AddGroupRow(Telerik.Windows.Documents.Model.Table table, QueryableCollectionViewGroup group, IList<GridViewBoundColumnBase> columns, RadGridView grid)
  {
    Telerik.Windows.Documents.Model.TableRow row = new Telerik.Windows.Documents.Model.TableRow();
 
    int level = GetGroupLevel(group);
    if (level > 0)
    {
      Telerik.Windows.Documents.Model.TableCell cell = new Telerik.Windows.Documents.Model.TableCell();
      cell.PreferredWidth = new TableWidthUnit(level * 20);
      cell.Background = GroupHeaderBackground;
      row.Cells.Add(cell);
    }
 
    Telerik.Windows.Documents.Model.TableCell aggregatesCell = new Telerik.Windows.Documents.Model.TableCell();
    aggregatesCell.Background = GroupHeaderBackground;
    aggregatesCell.ColumnSpan = columns.Count + (grid.GroupDescriptors.Count > 0 ? 1 : 0) - (level > 0 ? 1 : 0);
 
    AddCellValue(aggregatesCell, group.Key != null ? group.Key.ToString() : string.Empty);
 
    foreach (AggregateResult result in group.AggregateResults)
    {
      AddCellValue(aggregatesCell, result.FormattedValue != null ? result.FormattedValue.ToString() : string.Empty);
    }
 
    row.Cells.Add(aggregatesCell);
 
    table.Rows.Add(row);
 
    if (group.HasSubgroups)
    {
      foreach (var g in group.Subgroups)
      {
        AddGroupRow(table, g as QueryableCollectionViewGroup, columns, grid);
      }
    }
    else
    {
      AddDataRows(table, group.Items, columns, grid);
    }
  }
 
  private static void AddCellValue(Telerik.Windows.Documents.Model.TableCell cell, string value)
  {
    Telerik.Windows.Documents.Model.Paragraph paragraph = new Telerik.Windows.Documents.Model.Paragraph();
    cell.Blocks.Add(paragraph);
 
    Telerik.Windows.Documents.Model.Span span = new Telerik.Windows.Documents.Model.Span();
    span.Text = value;
 
    paragraph.Inlines.Add(span);
  }
 
  private static int GetGroupLevel(IGroup group)
  {
    int level = 0;
 
    IGroup parent = group.ParentGroup;
 
    while (parent != null)
    {
      level++;
      parent = parent.ParentGroup;
    }
 
    return level;
  }

Tanya
Telerik team
 answered on 18 Aug 2016
8 answers
516 views

When I click a date on the calendar screen and then return to the calendar the date I just visited shows up on the calendar as having a orange box around it.  How do I turn this off?  I assume it is either the highlighted date or selected date property (http://docs.telerik.com/devtools/wpf/controls/radcalendar/structure) as both of those have the organge box i don't want to appear.

Thank you for your help,
Andrew

Masha
Telerik team
 answered on 18 Aug 2016
1 answer
504 views

Hey everyone,

I have the following problem and I hope I just oversee a simple step. (First of all: Sorry, there are lots of german words in it, but it should be understandable what the problem is.)

In picture1 (see attached files) is shown how my RadGridView looks like. Behind the RadGridView my View (using MVVM) is build like that:

<telerik:RadGridView Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="4" HorizontalAlignment="Center" ShowGroupPanel="False" ItemsSource="{Binding Path=RowPLIGFKU.Rabattstaffel, ValidatesOnDataErrors=True}" AutoGenerateColumns="False">
         <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn Header="{Loc Key=PREISLISTE_LIST_RABATTSTAFFEL_ABMENGE}" DataMemberBinding="{Binding Path=[PGSTA]}"  MinWidth="80"/>
                <telerik:GridViewMaskedInputColumn Header="{Loc Key=PREISLISTE_LIST_RABATTSTAFFEL_RABATT}" DataMemberBinding="{Binding Path=[PGRAB]}"  MinWidth="80" DataFormatString="{}{0:n2} %"/>
                <telerik:GridViewMaskedInputColumn Header="{Loc Key=PREISLISTE_LIST_RABATTSTAFFEL_WERT}" DataMemberBinding="{Binding Path=[PGPRS]}" MinWidth="80" DataFormatString="{Binding RabattstaffelCurrency}" /> 
         </telerik:RadGridView.Columns>
</telerik:RadGridView>

In the second column I use the numeric DataFormatString, cause of some reason, when I use the actual percent DataFormatString ("{}{0:P}") I get 500% as result by input 5. - But why?!?! In my opinion that makes no sense. Really: Who needs this that way? 

However, my problem is in the third column, where I bind my DataFormatString to the proberty 'RabattstaffelCurrency'.

This is how I set the proberty in the ViewModel:

RabattstaffelCurrency = string.Format("{0} {1}", "{}{0:n2}", Session.Company.Value<Waehrung>(CompanyInfos.DefaultCurrency));

The result is shown in picture2. It is "{}{0:n2} EUR". And by seeing this picture it gets clear why I can't just write: {0:c2}. I need the abbreviation of the actual currency, not the symbol and that changes at the runtime by user interacitons

 

If I write it hardcoded like this "{}{0:n2} EUR" it works. I don't get a binding error or some other details, its just shows the data. And last but not least I need to say that this is a project at my work, so I have not the opportunity to implement some workarounds. 

Dilyan Traykov
Telerik team
 answered on 17 Aug 2016
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?