This project is read-only.

error cast in grouping datagrid

Mar 18, 2013 at 6:12 PM
Edited Mar 18, 2013 at 6:17 PM
HI ALL! :)

i have big problem maybe of configuration

Please help!!!!!!!!


impossible to cast error:
ExtendedGrid.Microsoft.Windows.Controls.DataGridTextColumn' the type 'ExtendedGrid.Interface.IExtendedColumn'.


My code

XAML:
<ExtendedGridControl:ExtendedDataGrid EnableRowVirtualization="False" GroupByControlVisibility="Visible"
                 EnableColumnVirtualization="False"  VerticalAlignment="Top" x:Name="datagrid2" RowHeaderWidth="35"   HideColumnChooser="False" 
                                          IsSynchronizedWithCurrentItem="True"  SelectionMode="Extended" SelectionUnit="CellOrRowHeader" Margin="111,295,274,0" Height="369" Background="#FFBCE2BC" BorderBrush="#FFAEC99E" HorizontalGridLinesBrush="#FF78976F" VerticalGridLinesBrush="#FFC1E4C4" Theme="Office2007Black">


c#:
public class fattura
{
    public string idfattura{get;set;}
    public string anno{ get; set; }
    public string mese{get;set;}
    public string agente{ get; set; }
    public string cliente{ get; set; }
    public string zona { get; set; }
    public string provincia{ get; set; }
    public string citta{ get; set; }
    public string articolo{ get; set; }
    public string nomearticolo{ get; set; }
    public string gruppo{ get; set; }
    public string sottogruppo { get; set; }
    public string famiglia { get; set; }
    public string sottofamiglia{ get; set; }
    public string importo { get; set; }
    public string gennaio{ get; set; }
    public string febbraio{get; set; }
    public string marzo{ get; set; }
    public string aprile { get; set; }
    public string maggio{ get; set; }
    public string giugno{ get; set; }
    public string luglio { get; set; }
    public string agosto{ get; set; }
    public string settembre { get; set; }
    public string ottobre { get; set; }
    public string novembre{ get; set; }
    public string dicembre{ get; set; }
    public string totale {get;set;}

}
ObservableCollection<fattura> fat = new ObservableCollection<fattura>();
    private void riempi_collezzione()
    {
        try
        {


            BI_STAGEDataSet ds = new BI_STAGEDataSet();
            BI_STAGEDataSetTableAdapters.FatturatoTableAdapter ad = new BI_STAGEDataSetTableAdapters.FatturatoTableAdapter();


             ad.Fill(ds.Fatturato, Convert.ToInt32(textnumimp.Text));




            //scorro il dataset

            foreach (DataRow Dr in ds.Tables[0].Rows)
            {
                fat.Add(new fattura { idfattura = Dr[0].ToString(),  anno = Dr[1].ToString(), mese = Dr[2].ToString(), agente = Dr[3].ToString(), cliente = Dr[4].ToString(), zona = Dr[5].ToString(), provincia = Dr[6].ToString(), citta = Dr[7].ToString(), articolo = Dr[8].ToString(), nomearticolo = Dr[9].ToString(), gruppo = Dr[10].ToString(), sottogruppo = Dr[11].ToString(), famiglia= Dr[12].ToString(), sottofamiglia = Dr[13].ToString(),importo=Dr[14].ToString()});

            }




             //DataGrid1.ItemsSource = fat;

             datagrid2.ItemsSource = fat;





        }
Mar 18, 2013 at 6:57 PM
Hi

Try to set property AutoGenerateColumns="True" .

If that dosent work post me sample solution.

e.g.
    <ExtendedGridControl:ExtendedDataGrid x:Name="grid"  __AutoGenerateColumns="True"__ HideColumnChooser="True" GroupByControlVisibility="Visible">
            
        </ExtendedGridControl:ExtendedDataGrid>
Mar 18, 2013 at 8:30 PM
Edited Mar 18, 2013 at 8:32 PM
Thanks,but not funciton this solution!!

Image

fills but creates exception

Can you tell me if these lines code are fine
maybe does not accept null values ?

xmlns:dg="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit"
xmlns:ExtendedGridControl="clr-namespace:ExtendedGrid.ExtendedGridControl;assembly=ExtendedGrid"
xmlns:ExtendedColumn="clr-namespace:ExtendedGrid.ExtendedColumn;assembly=ExtendedGrid"


Part of data grid:
    <ExtendedGridControl:ExtendedDataGrid   
        EnableRowVirtualization="False"
        GroupByControlVisibility="Visible"
        EnableColumnVirtualization="False" 
        VerticalAlignment="Top" x:Name="datagrid2"
        RowHeaderWidth="35"   
        HideColumnChooser="False" 
        IsSynchronizedWithCurrentItem="True" 
        SelectionMode="Extended"
        SelectionUnit="CellOrRowHeader"
        Margin="111,300,355,0"
        Height="364" 
        Background="#FFBCE2BC"
        BorderBrush="#FFAEC99E"
        HorizontalGridLinesBrush="#FF78976F" 
        VerticalGridLinesBrush="#FFC1E4C4"
        Theme="Office2007Black"
        AutoGenerateColumns="True">


    </ExtendedGridControl:ExtendedDataGrid>
Mar 18, 2013 at 10:45 PM
Hi

It seems that you are adding DataGridTextColumn somewhere in the code make sure you add ExtendedDataGridTextColumn only.

For e.g in xaml add this column if you are using something else
<ExtendedGridControl:ExtendedDataGrid x:Name="grid" ItemsSource="{Binding SourceTable}" AutoGenerateColumns="False" HideColumnChooser="True" GroupByControlVisibility="Visible"
                      >
        <Controls:DataGrid.Columns>
            <__ExtendedColumn:ExtendedDataGridTextColumn Header="Game Name" AllowAutoFilter="True" Width="100"
                                       Binding="{Binding GameName}"__ />
Mar 18, 2013 at 10:45 PM
Hi,

If above solution dosent work , please make a sample project and reproduce this issue and send it to me.

Regards,
bpoojary
Mar 19, 2013 at 8:51 AM
I have to "ExtendedColumn:ExtendedDataGridTextColumn"do for each column generated?

My columns are dynamically generated each time the touch of a button


for example
:
public class fattura
{
    public string idfattura{get;set;}
    public string anno{ get; set; }
    public string mese{get;set;}
    public string agente{ get; set; }
    public string cliente{ get; set; }
    public string zona { get; set; }
    public string provincia{ get; set; }
    public string citta{ get; set; }
    public string articolo{ get; set; }
    public string nomearticolo{ get; set; }
    public string gruppo{ get; set; }
    public string sottogruppo { get; set; }
    public string famiglia { get; set; }
    public string sottofamiglia{ get; set; }
    public string importo { get; set; }
    public string gennaio{ get; set; }
    public string febbraio{get; set; }
    public string marzo{ get; set; }
    public string aprile { get; set; }
    public string maggio{ get; set; }
    public string giugno{ get; set; }
    public string luglio { get; set; }
    public string agosto{ get; set; }
    public string settembre { get; set; }
    public string ottobre { get; set; }
    public string novembre{ get; set; }
    public string dicembre{ get; set; }
    public string totale {get;set;}

}
ObservableCollection<fattura> fat = new ObservableCollection<fattura>();


I do something like this for each type?
<ExtendedGridControl:ExtendedDataGrid x:Name="grid" ItemsSource="{Binding fat}" AutoGenerateColumns="False" HideColumnChooser="True" GroupByControlVisibility="Visible"
      <__ExtendedColumn:ExtendedDataGridTextColumn Header="cliente" AllowAutoFilter="True" Width="100"    Binding="{Binding cliente}"__ />

Mar 19, 2013 at 9:00 AM
Hi

Kindly use latest dll. And did your issue got resolved?
Mar 19, 2013 at 9:23 AM
I have to "ExtendedColumn:ExtendedDataGridTextColumn"do for each column generated?

My columns are dynamically generated each time the touch of a button


for example
:
public class fattura
{
    public string idfattura{get;set;}
    public string anno{ get; set; }
    public string mese{get;set;}
    public string agente{ get; set; }
    public string cliente{ get; set; }
    public string zona { get; set; }
    public string provincia{ get; set; }
    public string citta{ get; set; }
    public string articolo{ get; set; }
    public string nomearticolo{ get; set; }
    public string gruppo{ get; set; }
    public string sottogruppo { get; set; }
    public string famiglia { get; set; }
    public string sottofamiglia{ get; set; }
    public string importo { get; set; }
    public string gennaio{ get; set; }
    public string febbraio{get; set; }
    public string marzo{ get; set; }
    public string aprile { get; set; }
    public string maggio{ get; set; }
    public string giugno{ get; set; }
    public string luglio { get; set; }
    public string agosto{ get; set; }
    public string settembre { get; set; }
    public string ottobre { get; set; }
    public string novembre{ get; set; }
    public string dicembre{ get; set; }
    public string totale {get;set;}

}
ObservableCollection<fattura> fat = new ObservableCollection<fattura>();


I do something like this for each type?
<ExtendedGridControl:ExtendedDataGrid x:Name="grid" ItemsSource="{Binding fat}" AutoGenerateColumns="False" HideColumnChooser="True" GroupByControlVisibility="Visible"
      <__ExtendedColumn:ExtendedDataGridTextColumn Header="cliente" AllowAutoFilter="True" Width="100"    Binding="{Binding cliente}"__ />

Mar 19, 2013 at 9:26 AM
sorry for repet post


I can link to the latest dll
Mar 19, 2013 at 9:29 AM
sorry for repet post


I can link to the latest dll
Mar 19, 2013 at 9:42 AM
thanks a lot I solved! I can just you deserve a donation
Mar 19, 2013 at 10:56 AM
Welcome