Telerik Forums
UI for WPF Forum
0 answers
126 views
I am using RadGridview with RadEntityFrameworkDataSource and following MVVM pattern in a Project.
I have checked the example code in demo, and I am able to load data from entityframework.
My requirement is, the grid data to be loaded on a button click and also the grid needs to be editable with changes to be updated in table on a button click.

I know that it is possible with normal pattern, but please let me know how can it be achieved using MVVM pattern.

Regards,
Reyas Mohammed
Reyas
Top achievements
Rank 2
 asked on 12 Nov 2013
1 answer
89 views

Hi,

I need to restrict the floating windows to drop on Tabs.
I tried the "CanDropOnTabStrip" property, but its showing error.
Kindly let me know the solution to fix the problem.

screen shot attached for your reference.



Regards
Naveendiran
Kalin
Telerik team
 answered on 12 Nov 2013
1 answer
123 views
In my application I have a scenario where the user has one window open with the PDF Viewer control and they are looking at a pdf file then my application displays a modal dialog.  The user needs to be able to still scroll up/down in the PDF Viewer while this modal dialog is open.  I have given them some shortcut keys to scroll a page at a time (ctrl + pg up & ctrl + pg down) and then I send these commands to the control on the other window from the modal window.  This works for scrolling by a page but a lot of the time they just need to scroll a few lines.  Is there any API for the PDFViewer control that will allow me to send a command to scroll up or down a few lines?

Any help on this would be greatly appreciated!!!

Thanks in advance,
Lee
Alexander
Telerik team
 answered on 12 Nov 2013
1 answer
364 views
Hi,

How do you merge table cells programmatically?

I'm creating a table via code as customer merge field, but I need to merge my header row with with all cells within the same row so that is spans multiple columns.

I'm using library version 2013.1.220.40.

Here's my code thus far (Sorry it's quite long):

Table table = new Table();
 
//Payment Details Title **
Span spanPaymentDetails = new Span("Payment Details");
spanPaymentDetails.StyleName = "styleTableTitle14";
Paragraph paragraphPaymentDetails = new Paragraph();
paragraphPaymentDetails.Inlines.Add(spanPaymentDetails);
 
TableCell cellPaymentDetails = new TableCell();
cellPaymentDetails.Background = Colors.LightGray;
cellPaymentDetails.Blocks.Add(paragraphPaymentDetails);
 
 
//BACS
Span spanBACS = new Span("BACS:");
spanBACS.StyleName = "styleTableContent14";
spanBACS.FontStyle = FontStyles.Italic;
Paragraph paragraphBACS = new Paragraph();
paragraphBACS.Inlines.Add(spanBACS);
 
TableCell cellBACS = new TableCell();
cellBACS.Background = Colors.LightGray;
cellBACS.Blocks.Add(paragraphBACS);
 
 
//Bank
Span spanBankTitle = new Span("Bank: ");
spanBankTitle.StyleName = "styleTableContent14";
spanBankTitle.FontStyle = FontStyles.Italic;
Span spanBankDetail = new Span("HSBC");
spanBankDetail.StyleName = "styleTableContent14";
Paragraph paragraphBank = new Paragraph();
paragraphBank.Inlines.Add(spanBankTitle);
paragraphBank.Inlines.Add(spanBankDetail);
 
TableCell cellBank = new TableCell();
cellBank.Background = Colors.Transparent;
cellBank.Blocks.Add(paragraphBank);
 
 
//Account Name
Span spanAccountNameTitle = new Span("Account Name: ");
spanAccountNameTitle.StyleName = "styleTableContent14";
spanAccountNameTitle.FontStyle = FontStyles.Italic;
Span spanAccountNameDetail = new Span("My Company Name");
spanAccountNameDetail.StyleName = "styleTableContent14";
Paragraph paragraphAccountName = new Paragraph();
paragraphAccountName.Inlines.Add(spanAccountNameTitle);
paragraphAccountName.Inlines.Add(spanAccountNameDetail);
 
TableCell cellAccountName = new TableCell();
cellAccountName.Background = Colors.LightGray;
cellAccountName.Blocks.Add(paragraphAccountName);
 
 
//Sort Code
Span spanSortCodeTitle = new Span("Sort Code: ");
spanSortCodeTitle.StyleName = "styleTableContent14";
spanSortCodeTitle.FontStyle = FontStyles.Italic;
Span spanSortCodeDetail = new Span("22-11-33");
spanSortCodeDetail.StyleName = "styleTableContent14";
Paragraph paragraphSortCode = new Paragraph();
paragraphSortCode.Inlines.Add(spanSortCodeTitle);
paragraphSortCode.Inlines.Add(spanSortCodeDetail);
 
TableCell cellSortCode = new TableCell();
cellSortCode.Background = Colors.LightGray;
cellSortCode.Blocks.Add(paragraphSortCode);
 
 
//Account No.
Span spanAccountNoTitle = new Span("Account No. ");
spanAccountNoTitle.StyleName = "styleTableContent14";
spanAccountNoTitle.FontStyle = FontStyles.Italic;
Span spanAccountNoDetail = new Span("xxxx xxxx");
spanAccountNoDetail.StyleName = "styleTableContent14";
Paragraph paragraphAccountNo = new Paragraph();
paragraphAccountNo.Inlines.Add(spanAccountNoTitle);
paragraphAccountNo.Inlines.Add(spanAccountNoDetail);
 
TableCell cellAccountNo = new TableCell();
cellAccountNo.Background = Colors.LightGray;
cellAccountNo.Blocks.Add(paragraphAccountNo);
 
 
 
//Cheque
Span spanCheque = new Span("Cheque:");
spanCheque.StyleName = "styleTableContent14";
Paragraph paragraphCheque = new Paragraph();
paragraphCheque.Inlines.Add(spanCheque);
 
TableCell cellCheque = new TableCell();
cellCheque.Background = Colors.LightGray;
cellCheque.Blocks.Add(paragraphCheque);
 
 
//Cheque Made Payable To
Span spanChequeMadePayableTo = new Span("Made Payable To:");
spanChequeMadePayableTo.StyleName = "styleTableContent14";
Paragraph paragraphChequeMadePayableTo = new Paragraph();
paragraphChequeMadePayableTo.Inlines.Add(spanChequeMadePayableTo);
 
TableCell cellChequeMadePayableTo = new TableCell();
cellChequeMadePayableTo.Background = Colors.LightGray;
cellChequeMadePayableTo.Blocks.Add(paragraphChequeMadePayableTo);
 
 
//Cheque Details
Span spanChequeDetail = new Span("My Company Name");
spanChequeDetail.StyleName = "styleTableContent14";
Paragraph paragraphChequeDetail = new Paragraph();
paragraphChequeDetail.Inlines.Add(spanChequeDetail);
 
TableCell cellChequeDetail = new TableCell();
cellChequeDetail.Background = Colors.LightGray;
cellChequeDetail.Blocks.Add(paragraphChequeDetail);
 
 
 
 
//Add Cells To Table Row
TableRow rowTitle = new TableRow();
rowTitle.Cells.Add(cellPaymentDetails);
table.AddRow(rowTitle);
 
 
TableRow rowDetails = new TableRow();
rowDetails.Cells.Add(cellBACS);
rowDetails.Cells.Add(cellBank);
rowDetails.Cells.Add(cellAccountName);
rowDetails.Cells.Add(cellCheque);
rowDetails.Cells.Add(cellChequeMadePayableTo);
table.AddRow(rowDetails);
 
TableRow rowDetails2 = new TableRow();
rowDetails2.Cells.Add(new TableCell());
rowDetails2.Cells.Add(cellSortCode);
rowDetails2.Cells.Add(cellAccountNo);
rowDetails2.Cells.Add(new TableCell());
rowDetails2.Cells.Add(cellChequeDetail);
table.AddRow(rowDetails2);
 
//Change Cell Padding
table.CellPadding = new Padding(5, 3, 5, 3);
 
//Create Document & Apply Styles
RadDocument document = new RadDocument();
RadDocumentStyles.AddStylesToDocumentRepository(document);
 
Section section = new Section();
 
//Add Empty Paragraph
Paragraph paragraph = new Paragraph();
paragraph.StyleName = "paragraphMailMergeTable";
section.Blocks.Add(paragraph);
 
//Add Table
section.Blocks.Add(table);
 
//Add Empty Paragraph
Paragraph paragraph1 = new Paragraph();
paragraph1.StyleName = "paragraphMailMergeTable";
section.Blocks.Add(paragraph1);
 
//Add Section To Document
document.Sections.Add(section);
 
document.MeasureAndArrangeInDefaultSize();
 
return new DocumentFragment(document);


Thanks,

Rob

Robert
Top achievements
Rank 1
 answered on 12 Nov 2013
2 answers
152 views
Hi,

What's the best method to determine the current page number at the caret position or even a specified position?

I'm using library version 2013.1.220.40.

Thanks,

Rob
Robert
Top achievements
Rank 1
 answered on 12 Nov 2013
15 answers
967 views
Hi everyone,

I am developing a WPF application in which I use RadControls including RadDocking.
I want to execute code when a RadPane becomes docked or floating.
Is an event raised when a RadPane becomes docked or floating ?

Thank you in advance for your help
Pascal GUERY
Top achievements
Rank 1
 answered on 12 Nov 2013
6 answers
564 views
Hi,

I don't see a Telerik statusbar bar.  The microsoft toolbox has one but it doesn't support Telerik themes.  I'm asking for advise on how to proceed. The telerik toolkit handles all my need except for the statusbar.  

Thanks
Rich
N Mackay
Top achievements
Rank 1
 answered on 12 Nov 2013
1 answer
93 views
I have a categorical chart where X values are enum.
By default chart shows as x-axis labels the name of enum value.

Is it possible to insert a converter so that the label is automatically converted to a custom (localized) string?
Yavor
Telerik team
 answered on 12 Nov 2013
1 answer
128 views
I have a categorical chart where X values are enum.
By default chart shows as x-axis labels the name of enum value.

Is it possible to insert a converter so that the label is automatically converted to a custom (localized) string?
Yavor
Telerik team
 answered on 12 Nov 2013
3 answers
223 views

Kindly find the Below Code, this is the PrintExtensions Class that Prints an image of the Gridview data,
however on large amount of data, it takes maybe half an hour without doing anything and in the same time it consumes a lot of CPU memory.

but in small amount of data it works very fine. 
Any solution?

This is the Build of the rad controls I am using (RadControls for WPF, v.2012.2.1001.40)


Best Regards

public static class PrintExtensions
  
   {
  
       static FixedDocument ToFixedDocument(FrameworkElement element, PrintDialog dialog)
  
       {
  
  
  
           dialog.PrintTicket.PageOrientation = PageOrientation.Landscape;
  
           PrintCapabilities capabilities = dialog.PrintQueue.GetPrintCapabilities(dialog.PrintTicket);
  
           Size pageSize = new Size(dialog.PrintableAreaWidth, dialog.PrintableAreaHeight);
  
           Size extentSize = new Size(capabilities.PageImageableArea.ExtentWidth, capabilities.PageImageableArea.ExtentHeight);
  
           FixedDocument fixedDocument = new FixedDocument();
  
           element.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
  
           element.Arrange(new Rect(new Point(0, 0), element.DesiredSize));
  
           for (double y = 0; y < element.DesiredSize.Height; y += extentSize.Height)
  
           {
  
               for (double x = 0; x < element.DesiredSize.Width; x += extentSize.Width)
  
               {
  
                   VisualBrush brush = new VisualBrush(element);
  
                   brush.Stretch = Stretch.None;
  
                   brush.AlignmentX = AlignmentX.Left;
  
                   brush.AlignmentY = AlignmentY.Top;
  
                   brush.ViewboxUnits = BrushMappingMode.Absolute;
  
                   brush.TileMode = TileMode.None;
  
                   brush.Viewbox = new Rect(x, y, extentSize.Width, extentSize.Height);
  
                   PageContent pageContent = new PageContent();
  
                   FixedPage page = new FixedPage();
  
                   ((IAddChild)pageContent).AddChild(page);
  
                   fixedDocument.Pages.Add(pageContent);
  
                   page.Width = pageSize.Width;
  
                   page.Height = pageSize.Height;
  
                   Canvas canvas = new Canvas();
  
                   FixedPage.SetLeft(canvas, capabilities.PageImageableArea.OriginWidth);
  
                   FixedPage.SetTop(canvas, capabilities.PageImageableArea.OriginHeight);
  
                   canvas.Width = extentSize.Width;
  
                   canvas.Height = extentSize.Height;
  
                   canvas.Background = brush;
  
                   page.Children.Add(canvas);
  
  
  
               }
  
  
  
           }
  
           return fixedDocument;
 
  
  
       }
  
  
  
       static GridViewDataControl ToPrintFriendlyGrid(GridViewDataControl source)
  
       {
  
           var grid = new RadGridView()
  
           {
  
               ItemsSource = source.ItemsSource,
  
               RowIndicatorVisibility = Visibility.Collapsed,
  
               ShowGroupPanel = false,
  
               CanUserFreezeColumns = false,
  
               IsFilteringAllowed = false,
  
               EnableColumnVirtualization=false,
  
               AutoExpandGroups = true,
  
               AutoGenerateColumns = false,
  
               Margin=new Thickness(10,30,10,10),
  
               ShowColumnFooters=true,
  
               EnableRowVirtualization=true
  
                 
  
                 
  
           };
  
           double widthsum = 0;
  
           foreach (var column in source.Columns.OfType<GridViewDataColumn>())
  
           {
  
               widthsum += column.Width.DisplayValue;
  
           }
  
           foreach (var column in source.Columns.OfType<GridViewDataColumn>())
  
           {
  
                 
  
               GridViewDataColumn newColumn = new GridViewDataColumn();
  
               newColumn.Width = column.ActualWidth;
  
               newColumn.DisplayIndex = column.DisplayIndex;
  
               //newColumn.DataMemberBinding = new System.Windows.Data.Binding(column.UniqueName);
 
               newColumn.DataMemberBinding = column.DataMemberBinding; // Better to just copy the references to get all the custom formatting
 
               newColumn.DataFormatString = column.DataFormatString;
  
               newColumn.TextAlignment = column.TextAlignment;
  
               newColumn.Header = column.Header;
  
               newColumn.Footer = column.Footer;
  
               newColumn.Width = 1030/ widthsum * column.Width.DisplayValue;
  
                 
  
               if (column.DataType.Name == "Decimal")
  
               {
  
                   //newColumn.TextAlignment = TextAlignment.Right;
  
                   SumFunction sum = new SumFunction { ResultFormatString = "Total : {0}", Caption = "" };
  
                   sum.ResultFormatString = "{0:n}";
  
                   newColumn.AggregateFunctions.Add(sum);
  
                   newColumn.FooterTextAlignment = TextAlignment.Right;
  
               }
  
               else
  
               {
  
                   newColumn.TextWrapping = TextWrapping.Wrap;
  
                     
  
               }
  
  
  
  
  
  
  
               grid.Columns.Add(newColumn);
  
           }
  
  
  
  
  
            
  
           StyleManager.SetTheme(grid, StyleManager.GetTheme(grid));
  
  
  
           grid.SortDescriptors.AddRange(source.SortDescriptors);
  
           grid.GroupDescriptors.AddRange(source.GroupDescriptors);
  
           grid.FilterDescriptors.AddRange(source.FilterDescriptors);
  
              
  
           return grid;
  
       }
  
  
  
       public enum ZoomType
  
       {
  
           Full,
  
           Width,
  
           Height,
  
           TwoWide
  
  
  
  
  
  
  
       };
  
  
  
  
  
       private static double constrain(double val, double val_min, double val_max)
  
       {
  
           if (val < val_min) return val_min;
  
           else if (val > val_max) return val_max;
  
           else return val;
  
       }
 
  
  
  
  
       public static void PrintPreview(this GridViewDataControl source,string title)
  
       {
  
  
  
           Window window = new Window();
  
           window.Title = "Print Preview";
  
           if (!string.IsNullOrWhiteSpace(source.ToolTip as string)) window.Title += " of " + source.ToolTip;
  
           window.Width = SystemParameters.PrimaryScreenWidth * 0.92;
  
           window.Height = SystemParameters.WorkArea.Height;
  
           window.Left = constrain(SystemParameters.VirtualScreenWidth - SystemParameters.PrimaryScreenWidth, 0, SystemParameters.VirtualScreenWidth - 11);
  
           window.Top = constrain(0, 0, SystemParameters.VirtualScreenHeight - 25);
  
           DocumentViewer viewer = new DocumentViewer();
  
           viewer.Document = ToFixedDocument(ToPrintFriendlyGrid(source), new PrintDialog());
  
           Zoom(viewer, ZoomType.Full);
  
           window.Content = viewer;
  
           window.Show();
  
  
  
       }
  
  
  
       public static void Zoom(DocumentViewer viewer, ZoomType zoom)
  
       {
  
           switch (zoom)
  
           {
  
               case ZoomType.Height: viewer.FitToHeight(); break;
  
               case ZoomType.Width: viewer.FitToWidth(); break;
  
               case ZoomType.TwoWide: viewer.FitToMaxPagesAcross(2); break;
  
               case ZoomType.Full: break;
  
           }
  
  
  
  
  
  
  
       }
 
  
  
       public static void Print(this GridViewDataControl source, bool showDialog, string title)
  
       {
  
           var dialog = new PrintDialog();
  
           var dialogResult = showDialog ? dialog.ShowDialog() : true;
  
  
  
           if (dialogResult == true)
  
           {
  
               var viewer = new DocumentViewer();
  
               Grid maingrid = new Grid();
  
               ColumnDefinition gridCol1 = new ColumnDefinition();
  
               maingrid.ColumnDefinitions.Add(gridCol1);
  
               RowDefinition gridRow1 = new RowDefinition();
  
               RowDefinition gridRow2 = new RowDefinition();
  
               maingrid.RowDefinitions.Add(gridRow1);
  
               maingrid.RowDefinitions.Add(gridRow2);
  
  
  
               TextBlock txtBlock1 = new TextBlock();
  
               txtBlock1.Text = title;
  
               txtBlock1.Margin = new Thickness(2, 2, 2, 2);
  
               txtBlock1.TextAlignment = TextAlignment.Center;
  
  
  
  
  
               Grid.SetRow(txtBlock1, 0);
  
               Grid.SetRow(ToPrintFriendlyGrid(source), 1);
  
               maingrid.Children.Add(txtBlock1);
  
               maingrid.Children.Add(ToPrintFriendlyGrid(source));
  
  
  
               viewer.Document = ToFixedDocument(maingrid, dialog);
  
               dialog.PrintDocument(viewer.Document.DocumentPaginator, "");
  
           }
  
       }
  
   }



Dimitrina
Telerik team
 answered on 12 Nov 2013
Narrow your results
Selected tags
Tags
GridView
General Discussions
Chart
RichTextBox
Docking
ScheduleView
ChartView
TreeView
Diagram
Map
ComboBox
TreeListView
Window
RibbonView and RibbonWindow
PropertyGrid
DragAndDrop
TabControl
TileView
Carousel
DataForm
PDFViewer
MaskedInput (Numeric, DateTime, Text, Currency)
AutoCompleteBox
DatePicker
Buttons
ListBox
GanttView
PivotGrid
Spreadsheet
Gauges
NumericUpDown
PanelBar
DateTimePicker
DataFilter
Menu
ContextMenu
TimeLine
Calendar
Installer and Visual Studio Extensions
ImageEditor
BusyIndicator
Expander
Slider
TileList
PersistenceFramework
DataPager
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
WatermarkTextBox
DesktopAlert
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
ProgressBar
Sparkline
LayoutControl
TabbedWindow
ToolTip
CloudUpload
ColorEditor
TreeMap and PivotMap
EntityFrameworkCoreDataSource (.Net Core)
HeatMap
Chat (Conversational UI)
VirtualizingWrapPanel
Calculator
NotifyIcon
TaskBoard
TimeSpanPicker
BulletGraph
Licensing
WebCam
CardView
DataBar
FilePathPicker
PasswordBox
Rating
SplashScreen
Accessibility
Callout
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?