Telerik Forums
UI for WPF Forum
5 answers
215 views
Hi,

Is it possible to merge documents and add a custom header / footer programmatically or via a template?

Ideally, I would like to create a header and footer template using the RadRichTextBox UI.

My application merges several documents together, where I would like to be able to apply a common header and footer style/design to them programmatically using a template that was previously designed. ** I'm only interested in the header and footer.

I know how to merge documents together, I would just like to know how I can design a Header & Footer document template and apply that design/template programmatically to the other merged documents.

Any examples that you have would be very welcome.

Thank you very much for your time,

Rob
Robert
Top achievements
Rank 1
 answered on 15 Nov 2012
0 answers
121 views
<Window x:Class="AggregateFunctions.MainWindow"
         WindowState="Maximized"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <telerik:RadGridView HorizontalAlignment="Stretch" Margin="5" Name="radGridView1" VerticalAlignment="Stretch" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3"
                             AutoGenerateColumns="True" CanUserDeleteRows="False" CanUserInsertRows="False" CanUserSelect="False" GridLinesVisibility="Horizontal"
                             ShowInsertRow="False" ShowGroupFooters="False" ShowColumnHeaders="True" RowIndicatorVisibility="Collapsed" FrozenColumnCount="3"
                             AlternationCount="2"  Loaded="radGridView1_Loaded"
                             AlternateRowBackground="#F8F8F8" AutoGeneratingColumn="radGridView1_AutoGeneratingColumn">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn Header="Company Name" DataMemberBinding="{Binding CompanyName}" Width="180" IsReadOnly="True"></telerik:GridViewDataColumn>
                <telerik:GridViewDataColumn Header="Ticker" DataMemberBinding="{Binding Ticker}" Width="80" IsReadOnly="True"></telerik:GridViewDataColumn>
                <telerik:GridViewDataColumn Header="MIC" DataMemberBinding="{Binding MicCode}" IsReadOnly="True"></telerik:GridViewDataColumn>
                <telerik:GridViewDataColumn Header="Publisher" DataMemberBinding="{Binding Publisher}" IsReadOnly="True"></telerik:GridViewDataColumn>
                <telerik:GridViewDataColumn Header="Industry" DataMemberBinding="{Binding Industry}" IsReadOnly="True"></telerik:GridViewDataColumn>
                <telerik:GridViewDataColumn Header="Model Name" DataMemberBinding="{Binding RegressionName}" Width="180" IsReadOnly="True"></telerik:GridViewDataColumn>
                <telerik:GridViewDataColumn Header="Multiple" DataMemberBinding="{Binding Multiple}" Width="120" IsReadOnly="True"></telerik:GridViewDataColumn>
                <telerik:GridViewDataColumn Header="Qtrs Lead" DataMemberBinding="{Binding NumQtrsLead}" IsReadOnly="True"></telerik:GridViewDataColumn>
                <telerik:GridViewDataColumn Header="Time Period" DataMemberBinding="{Binding TimePeriod}" DataFormatString="{}{0:MM/dd/yyyy}"  IsReadOnly="True"></telerik:GridViewDataColumn>
                <telerik:GridViewDataColumn Header="Model Case" DataMemberBinding="{Binding ModelCase}" IsReadOnly="True"></telerik:GridViewDataColumn>
                <telerik:GridViewDataColumn Header="Is Default" DataMemberBinding="{Binding IsDefault}" IsReadOnly="True"></telerik:GridViewDataColumn>
                <telerik:GridViewDataColumn Header="R. Squared" DataMemberBinding="{Binding RSquared}" IsReadOnly="True" TextAlignment="Right"></telerik:GridViewDataColumn>
                <telerik:GridViewDataColumn Header="Indicator Percentile" DataMemberBinding="{Binding IndicatorPercentile}" DataFormatString="{}{0:P2}" TextAlignment="Right"  IsReadOnly="True"></telerik:GridViewDataColumn>
                <telerik:GridViewDataColumn Header="Over Under Valuation" DataMemberBinding="{Binding OverUnderValuation}" DataFormatString="{}{0:P2}" TextAlignment="Right" IsReadOnly="True"></telerik:GridViewDataColumn>
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
    </Grid>
</Window>
using System;
using System.Collections.Generic;
using System.Data;
using System.Windows;
using Telerik.Windows.Controls;
 
namespace AggregateFunctions
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        List<string> lstColumns = new List<string>();       
        public MainWindow()
        {
            InitializeComponent();
 
            lstColumns.Add("CompanyName");
            lstColumns.Add("Ticker");
            lstColumns.Add("MicCode");
            lstColumns.Add("RegressionName");
            lstColumns.Add("Publisher");
            lstColumns.Add("Industry");
            lstColumns.Add("Multiple");
            lstColumns.Add("NumQtrsLead");
            lstColumns.Add("TimePeriod");
            lstColumns.Add("ModelCase");           
            lstColumns.Add("RSquared");
            lstColumns.Add("IndicatorPercentile");
            lstColumns.Add("OverUnderValuation");
        }
 
        private void radGridView1_AutoGeneratingColumn(object sender, Telerik.Windows.Controls.GridViewAutoGeneratingColumnEventArgs e)
        {
            if (lstColumns.Contains(e.Column.UniqueName))
                e.Cancel = true;
            else
            {
                e.Column.TextAlignment = TextAlignment.Right;
                e.Column.Width = new GridViewLength(110);
                e.Column.IsReadOnly = true;
            }
        }
 
        private DataTable LoadData()
        {
            int counter = 0;
            DataTable dt = new DataTable();
            foreach (var item in lstColumns)
            {
                if (counter <= 6)
                    dt.Columns.Add(item, typeof(string));
                else if (counter == 7)
                    dt.Columns.Add(item, typeof(int));
                else if (counter == 8)
                    dt.Columns.Add(item, typeof(DateTime));
                else if (counter == 9)
                    dt.Columns.Add(item, typeof(string));               
                else
                    dt.Columns.Add(item, typeof(double));
 
                counter++;
            }
 
            dt.Columns.Add("OilWith1M", typeof(double));
            dt.Columns.Add("CapUtilPC", typeof(double));
            dt.Columns.Add("UnEmployement", typeof(double));
            dt.Columns.Add("NaturalGas", typeof(double));
            dt.Columns.Add("10YTreasury", typeof(double));
            dt.Columns.Add("USUnEmployemnet", typeof(double));
            dt.Columns.Add("IndustrialProduction", typeof(double));
            dt.Columns.Add("NewHomeSales", typeof(double));
            dt.Columns.Add("InventorySalesRatio", typeof(double));
            dt.Columns.Add("NaturalGasNYM", typeof(double));
 
            Random r = new Random();
            for (int i = 1; i < 500; i++)
            {
                DataRow row = dt.NewRow();
                counter = 0;
                foreach (var item in dt.Columns)
                {
                    if (counter <= 6)
                        row[item.ToString()] = Guid.NewGuid().ToString().Substring(0, 5);
                    else if (counter == 7)
                        row[item.ToString()] = r.Next(1000 * i);
                    else if (counter == 8)
                        row[item.ToString()] = DateTime.Now.AddDays(i);
                    else if (counter == 9)
                        row[item.ToString()] = Guid.NewGuid().ToString().Substring(0, 5);                   
                    else
                        row[item.ToString()] = r.Next(1000 * i);                   
 
                    counter++;
                }              
 
                dt.Rows.Add(row);
            }
 
            return dt;
        }
 
        private void radGridView1_Loaded(object sender, RoutedEventArgs e)
        {
            this.radGridView1.ItemsSource = LoadData();
        }
    }
}
Hi All,

I use RadGridView and i apply group by functionality, When the user groups by a particular column, could we adds row at bottom of each group (or it top header row) with average for the all the columns from R. Squared to the right.
(Its my grid column) 
Sufyan
Top achievements
Rank 1
 asked on 15 Nov 2012
0 answers
130 views
I have a screen that has a radgridview on it when the users selects a row it populates the screen with data about the selected row.  When the user either adds a new record or updates and existing row I run an update then reload the grid with the new data and also to check and see if any other users have shanged any data.  The issue I am having is I would like to set the selected row to the row that was just added or to the row the user has just updated.
How can I set the selected row by an ID on the gird?
Eric Klein
Top achievements
Rank 1
 asked on 15 Nov 2012
2 answers
209 views
Hi,

I'm using a RadGridView and RadDataPager together:
<telerik:RadGridView Margin="0,0,0,0"
              Name="grdGeneralPayments"
              SelectionMode="Extended"
              ShowGroupPanel="False"
              ShowColumnFooters="False"    
              CanUserSelect="False"
              CanUserInsertRows="False"
              CanUserDeleteRows="False"
              IsSynchronizedWithCurrentItem ="False"
              MouseDoubleClick="grdGeneralPayments_MouseDoubleClick"
              SelectionChanged="grdGeneralPayments_SelectionChanged"
              Filtering="grdGeneralPayments_Filtering"
              Filtered="grdGeneralPayments_Filtered"
              ScrollViewer.VerticalScrollBarVisibility="Auto"
              ScrollViewer.HorizontalScrollBarVisibility="Auto"
              DockPanel.Dock="Top">
</telerik:RadGridView>
<telerik:RadDataPager Name="radDataPager" Margin="0,0,0,0" DockPanel.Dock="Bottom" PageSize="10" Source="{Binding Items, ElementName=grdGeneralPayments}"
                          PageIndexChanging="radDataPager_PageIndexChanging" />


The grid also has a checkbox select column.
//Because grid columns are auto generated we need to add the select row checkbox column ourselves.
GridViewSelectColumn selectCol = new GridViewSelectColumn();
selectCol.Name = "Select";
//Put select row checkbox column on LHS of the grid.
this.grdGeneralPayments.Columns.Insert(0, selectCol);


Desired behaviour:
The user selects a number of items on one page.
User navigates to another page.
User navigates back to previous page and the previously selected items are still shown as selected.

The following code was working using Telerik.Windows.Controls.GridView.dll version 2010.1.422.35:
public ApproveGeneralPayments()
{
    InitializeComponent();
    this.grdGeneralPayments.Items.PageChanged += new EventHandler<EventArgs>(Items_PageChanged);
}
       
private void Items_PageChanged(object sender, EventArgs e)
{
      this.SelectGloballySelectedItems();
      this.changingPage = false;
}


Since upgrading to Telerik.Windows.Controls.GridView.dll version 2012.2.607.40, the above event "Items_PageChanged" fails to fire.

NB. The method "SelectGloballySelectedItems" compares the items on the currently displayed page with those which have been previously  selected across multiple pages and reselects them.

Any idea why the event isn't firing or is there a new way to achieve the desired functionality.

Thanks,
Mark
Mark Newman
Top achievements
Rank 1
 answered on 15 Nov 2012
3 answers
123 views
Are there any demos of 3D charts, specifically pie charts, I can't see any, indeed I can't really find any useful documentation about 3D charts at all.
Petar Kirov
Telerik team
 answered on 15 Nov 2012
5 answers
354 views
Is there a way to cleanly get a RadGridView to clear its SortDescriptors everytime the ItemSource is refreshed with a new data source?

My problem is that I am loading different dataset (different columns) into a RadGridView and when there is sorting on one of the data set, after binding a new dataset to the same RadGridView, it is obviously remembering the SortDescriptor and throwing an error because the column it is trying to sort on no longer exists in the new set of data it is being bound to.

Also I am trying to do this in a clean MVVM (WPF) way so calling RadGridView.SortDescriptors.Clear() in the code behind of my WPF form is not the approach I'm looking for.

Any ideas?
Mark
Top achievements
Rank 1
 answered on 15 Nov 2012
0 answers
54 views
Hello, I´m working with 2011.3.1116.40 WPF version, I handle Filtered event, when I follow these steps, FilterDescriptors doesn´t update correctly:

1- Check one filter item -> FilterDescriptors OK.
2- Uncheck "Select all" -> FilterDescriptors wrong. FilterDescriptos continues with the last value.

It happens on filtered method.

Thanks for your support.
Gerardo
Top achievements
Rank 1
 asked on 15 Nov 2012
1 answer
68 views
Hi,

I should implement a dynamic combobox to be WPF gridviews cell editor. I need to create the combobox to some specific cell (for example to row 3 and column 2). The data should get from database in moment the user is activating the cell editing.

Already i found examples how to create GridViewComboBoxColumn, but i need to do this to just one cell at the time and the data must be fetched from relational database dynamic. That is because the data can be updated to the database at any time by other user/process.

What to do next?
Pavel Pavlov
Telerik team
 answered on 15 Nov 2012
1 answer
122 views
Hi,

how do i bind a xml-File to a RadDataForm with a NewItemTemplate and a EditTemplate? Can't find any example!=

Thanks Best
Regards
Rene
Yoan
Telerik team
 answered on 15 Nov 2012
2 answers
99 views
Hi,

I made a control teplate, and i put a RadDatePicker to this. After that, i set the DataTimeWaterMarkContent propterty. But its doesnt show on the UI.
If i use it direct ( Window, UserControl) it's ok.

Control Template:

<ControlTemplate x:Key="OtherWorkEditTemplate">

<Grid x:Name="LayoutRoot">

<GroupBox Header="Something" BorderBrush="{DynamicResource SolidColorBlueBrush}">

<Grid>

...

<telerik:RadDatePicker SelectedValue="{Binding OtherWork.InvoiceDate}" VerticalAlignment="Top" Margin="88.787,98.458,8,0" DateTimeWatermarkContent="Enter" telerik:StyleManager.Theme="Metro" />

</Grid>

</GroupBox>

</Grid>

</ControlTemplate>


Result: http://tinypic.com/r/qp4bb5/6
[IMG]http://i47.tinypic.com/qp4bb5.png[/IMG]

 
How can i solve this?

Thanks a lot,
Attila

 

Attila
Top achievements
Rank 1
 answered on 15 Nov 2012
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?