Telerik Forums
UI for WPF Forum
3 answers
163 views
I want to print two pages per sheet .Because I have one GridView and only three columns are available in the GridView. So remaining part of the page are unuseful.
so that I set  PrintDialog.PrintTicket.PagesPerSheet = 2 and PrintDialog.PrintQueue.DefaultPrintTicket.PagesPerSheet = 2. But its not working. And I am using following code for the Printing.

public static void Print(this GridViewDataControl source, bool showDialog, bool p_IsLandscape = true)
        {
            try
            {
                PrintDialog _PrintDialog = new PrintDialog();
                _PrintDialog.PrintQueue = LocalPrintServer.GetDefaultPrintQueue();
                _PrintDialog.PrintTicket = _PrintDialog.PrintQueue.DefaultPrintTicket;
              
                if (p_IsLandscape)
                    _PrintDialog.PrintTicket.PageOrientation = PageOrientation.Landscape;
                else
                {
                    _PrintDialog.PrintTicket.PageOrientation = PageOrientation.Portrait;
                    _PrintDialog.PrintTicket.PagesPerSheet = 2;
                    _PrintDialog.PrintQueue.DefaultPrintTicket.PagesPerSheet = 2;
                }

                bool? dialogResult = showDialog ? _PrintDialog.ShowDialog() : true;

                if (dialogResult == true)
                {
                    DocumentViewer viewer = new DocumentViewer();
                    viewer.Document = ToFixedDocument(ToPrintFriendlyGrid(source), _PrintDialog);
                    _PrintDialog.PrintDocument(viewer.Document.DocumentPaginator, null);
                }
            }
            catch
            {
                   throw _Exception;
            }
        }

static FixedDocument ToFixedDocument(FrameworkElement element, PrintDialog dialog)
        {
            PrintCapabilities capabilities = dialog.PrintQueue.GetPrintCapabilities(dialog.PrintTicket);
            FixedDocument fixedDocument = new FixedDocument();

            element.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));

            Size pageSize = new Size(element.DesiredSize.Width, dialog.PrintableAreaHeight);
            Size extentSize = new Size(element.DesiredSize.Width, capabilities.PageImageableArea.ExtentHeight);

            double totalHeight = element.DesiredSize.Height;
            double totalWidth = element.DesiredSize.Width;
            double yOffset = 0d;

            if (totalWidth < dialog.PrintableAreaWidth)
            {
                Size _Size = new Size(dialog.PrintableAreaWidth, dialog.PrintableAreaHeight);
                element.Arrange(new Rect(new Point(0, 0), _Size));
            }
            else
            {
                element.Arrange(new Rect(new Point(0, 0), element.DesiredSize));
            }

            while (yOffset < totalHeight)
            {
                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;
                if (totalWidth < dialog.PrintableAreaWidth)
                    brush.Viewbox = new Rect(0, yOffset, dialog.PrintableAreaWidth, extentSize.Height);
                else
                    brush.Viewbox = new Rect(0, yOffset, extentSize.Width, extentSize.Height);

                PageContent pageContent = new PageContent();
                FixedPage page = new FixedPage();
                ((IAddChild)pageContent).AddChild(page);

                fixedDocument.Pages.Add(pageContent);

                if (totalWidth < dialog.PrintableAreaWidth)
                    page.Width = dialog.PrintableAreaWidth;
                else
                    page.Width = totalWidth;

                page.Height = pageSize.Height;

                Canvas canvas = new Canvas();
                FixedPage.SetLeft(canvas, capabilities.PageImageableArea.OriginWidth);
                FixedPage.SetTop(canvas, capabilities.PageImageableArea.OriginHeight);

                if (totalWidth < dialog.PrintableAreaWidth)
                    canvas.Width = dialog.PrintableAreaWidth;
                else
                    canvas.Width = extentSize.Width;

                canvas.Height = extentSize.Height;
                canvas.Background = brush;

                page.Children.Add(canvas);

                yOffset += extentSize.Height;
            }
            return fixedDocument;
        }

Can you help

Thanks
Petya
Telerik team
 answered on 10 Apr 2014
1 answer
86 views
I have a gridview which has 4,100 rows and 30 columns. If I scroll the grid to the right (in other words so I can see columns 18 thru 30) and then choose to filter on one of those columns, the default filter dialog pops up as expected. However as soon as I select a value in the pop-up dialog the grid immediately scrolls to the left, the dialog stays visible but 'empties'. I then scroll the grid to the right and the filter has been applied as expected. If I filter on a column that is visible initially (i.e. columns 1 thru 17) then this problem does not exist, Is this behavior by design and if so how do I turn it off or if it is a problem is their a work around or fix available. Please advise - thanks
Dimitrina
Telerik team
 answered on 10 Apr 2014
2 answers
132 views
Hello!

I have been fighting with this for a day now, and I'm running out of fuel. My main form has a Toolbars-collection containing ToolbarViewModels having properties like Band and BandIndex to bind to. I use the following xaml for my main form:

        <telerik:RadToolBarTray
               Name="Toolbars"
               Grid.Row="1"
               ItemsSource="{Binding Path=Toolbars}"
               IsLocked="False"
            >

            <telerik:RadToolBarTray.ItemTemplate>
                <DataTemplate>
                    <telerik:RadToolBar 
                        Band="{Binding Path=Band}"
                        BandIndex="{Binding Path=BandIndex}"
                        ItemsSource="{Binding Path=Elements}"
                          >
                        <telerik:RadToolBar.ItemTemplate>
                            <DataTemplate>

                             ...this part works, as the toolbars have content

                            </DataTemplate>
                        </telerik:RadToolBar.ItemTemplate>
                    </telerik:RadToolBar>
                </DataTemplate>
            </telerik:RadToolBarTray.ItemTemplate>
        </telerik:RadToolBarTray>

As far as I can see, this should work. But what happens is that the last toolbar added to the Toolbars-collection is the topmost, and all other ones end up underneath it & invisible, stacked on top of each other in "Z-order". So in effect what doesn't seem to work is the BandIndex. The BandIndex getter of the view model is also accessed when the toolbar is added.

I have tried different alignment and content alignment combinations, but all toolbars still end up in the same place.

Any help appreciated,

Kim Johnsson
Kim
Top achievements
Rank 1
 answered on 10 Apr 2014
3 answers
80 views
Hello,

I am binding the ItemsSource of a ScatterLineSeries to some Linq Enumerable.
Is it possible to use the index (and not some property inside of the item) as x-coordinate?

Additionally, is it possible to specify a dot-separated path inside the XValueBinding (e.g. XValueBinding="Parent.X1")?

Thank you in advance!

Alex
Petar Marchev
Telerik team
 answered on 10 Apr 2014
1 answer
329 views
I have a RadGridView bound via the ItemsSource property to an QueryableCollectionView which is exposed as an IEnumerable property in a ViewModel. This ViewModel is the contents of a TabControl (RadTabControl).

The tab contorl does not persist the visual tree when the tabs are changed (as expected), but because I'm using QueryableCollectionView the view state of the grid is persisted.

When I go back to the original tab any filtering is reapplied as expected (great!) but the the inidividual column filters haven't been updated - the filter icon in the column header has not changed colour and importantly the column filters UI does not show all filtering possiblities.

Can some explain how I can get the grid to display correctly when it is re-bound to a QueryableCollectionView which has FilterDescriptors already defined?


Cheers

Ollie Riches
Dimitrina
Telerik team
 answered on 10 Apr 2014
7 answers
219 views
Hello
     We've noticed on our application that showing a grid for large collections causese the application to use huge ammount of memory and throw OutOfMemory exception.

We've created a demo project cotaining 5 million enties containing two string.
Creating the data context raised memory consumption of the application to 450MB.
Showing the window containing the RadGridView raised memory consumption to 800MB.
All grid rows are set, no infinity/auto exists.

Any ideas?
Dimitrina
Telerik team
 answered on 10 Apr 2014
8 answers
168 views

Hello,
I am using your tileView in my app.
I am using a tile that every item in it is itself a tileView of user controls.
I am having an exception when I switch the itemsource of the outer tile (which effects the inner ones as well as they are binded to it).
The big tile's itemsource is binded to a treeview's itemsource. 
Whenever there is a change in the treeview's collection (the tree has checkboxes the decide which tiles will be visible) I am updating the binding manually (getting the binding expression and updating).
In a converter I convert the collection (a ListCollectionView of the viewmodel class of the user controls, filtered into groups) that I got from the tree to a collection that contains only the groups that are checked in the checkboxes (the groups are the outer tileItems). 
In the converter I copy the collection and delete only the groups that are unchecked (not supposed to be visible).
The user controls within each group are binded to a boolean property that tells the visibility of the items (with a converter).
The problem is that sometimes when I update the binding, I get notification of a tilePositionChanged of the inner tileView (that contains the user controls). 
The position that I get is -1, and that value does not come from my viewmodel (I checked).
Than I get an exception thrown because the tileView tries to put an item's column property to -1.
This does not happen every time, only when checking or unchecking an item and than I refresh the binding of the bigger TileView(which the inner ones are binded to).

I hope you have enough data.
unfortunately i can't attach the code.

Thank you in advanced,
Tamir.

Zarko
Telerik team
 answered on 09 Apr 2014
3 answers
211 views
I'm using WPF/MVVM

For all parent rows that have Employees.Count > 0, I need to have the row details expanded. Can you tell me how to do this. Again, I'm using MVVM and NOT using events. This needs to be done with binding.

Thanks
Yoan
Telerik team
 answered on 09 Apr 2014
1 answer
89 views
Hi all,
I currently have a problem with applying Style for TextBlock when TextBlock is in RadDocking control. I have a simple example below.

- The app will use Windows8Theme

public App()
{
    StyleManager.ApplicationTheme = new Windows8Theme();
}

The TextBlock is set with FontWeight Bold.

<telerik:RadDocking Grid.Row="1" HasDocumentHost="False">
    <telerik:RadSplitContainer Orientation="Horizontal">
        <telerik:RadPaneGroup telerik:ProportionalStackPanel.RelativeSize="200, 200">
            <telerik:RadPane PaneHeaderVisibility="Collapsed">
                <Grid>
                    <TextBlock FontWeight="Bold" Margin="50" Foreground="Green" Text="HIHI" />
                </Grid>
            </telerik:RadPane>
        </telerik:RadPaneGroup>
    </telerik:RadSplitContainer>
</telerik:RadDocking>

In the designer it was correctly displayed

http://i.imgur.com/dRAuixu.png

But in runtime it was not

http://i.imgur.com/F1Cchw1.png

I think that setting ApplicationTheme in App() has overwritten the Style of TextBlock.

Question: What should I do to keep FontWeight of TextBlock from overwriting by StyleManager?

Vladi
Telerik team
 answered on 09 Apr 2014
1 answer
157 views
Hi,
I am having multiple issues around the mini tool bar, the main issue is that when a user uses the select all command(Ctrl + a) this tool bar doesn't show.
Second issue is the tool bar visibility is very temperament so is there anyway to make it permanently visible when there are selected items - and possibly add the ability to move/dock this.
Any help would be appreciated.
Thanks
-Chris
Petya
Telerik team
 answered on 09 Apr 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?