using standard datagrid controls in extended datagrid?

Jul 13, 2012 at 2:32 PM

Hi,

 

is it possible, to use some controls from standard DataGrid in the extended one?

I'd like to use controls like combobox, DatePicker etc.

If its possible please show me how I can manage this.

 

Thank you

Coordinator
Jul 14, 2012 at 4:55 AM

Hi

 

You can use it.

Please donwload the source code for Extended DataGrid. You will see folder Extended Columns. Add your columns similarly as I did for ExtendedDataGridTextColumn .

My machine crashed or I would have posted solution . But its easy.

May be by tomorrow I can post big release which is pending and I believe I have already added this.

 

Regards,

Bhushan Poojary

Coordinator
Jul 14, 2012 at 4:56 AM

For e.g it would look like this

http://wpfextendeddatagrid.codeplex.com/SourceControl/changeset/view/6375#96888

Jul 14, 2012 at 3:47 PM
Edited Jul 16, 2012 at 10:04 AM

 

If I try to create a new Extended TemplateColumn like

public class ExtendedDataGridTemplateColumn : DataGridTemplateColumn, IExtendedColumn

the XAML source will not compile with this error

(edited)

Error 16 The tag 'ExtendedDataGridTemplateColumn.CellTemplate' does not exist in XML namespace 'http://schemas.microsoft.com/winfx/2006/xaml/presentation'. Line 62, position 30.  ...

Standard GridTemplateColumn has and uses a DependencyProperty CellTemplate that does not exist in the extended version.

(edited)  I've removed the obj and bin folder and this now disappear! sorry.

or

(However this remains!!)

Error 15 Unable to instantiate "ExtendedDataGridTemplateColumn". 

This is how I use my TemplateColum

    <ExtendedColumn:ExtendedDataGridTemplateColumn Header="Room Status">
        <ExtendedColumn:ExtendedDataGridTemplateColumn.CellTemplate>
            <DataTemplate>
                <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
                    <Ellipse Height="20" Width="20"  Margin="12"  Stroke="Black" Fill="{Binding AlarmRoomFlagLed}" Visibility="Visible" />
                    <Ellipse Height="20" Width="20"  Margin="12"  Stroke="Black" Fill="{Binding ServiceRoomFlagLed}" Visibility="Visible"/>
                    <Ellipse Height="20" Width="20"  Margin="12"  Stroke="Black" Fill="{Binding DoNotDisturbRoomFlagLed}" Visibility="Visible"/>
                    <Ellipse Height="20" Width="20"  Margin="12"  Stroke="Black" Fill="{Binding BusyRoomFlagLed}" Visibility="Visible"/>
                    <Ellipse Height="20" Width="20"  Margin="12"  Stroke="Black" Fill="{Binding FreeRoomFlagLed}" Visibility="Visible"/>
                </StackPanel>
            </DataTemplate>
        </ExtendedColumn:ExtendedDataGridTemplateColumn.CellTemplate>
    </ExtendedColumn:ExtendedDataGridTemplateColumn>

 

Thank you!

Sep 12, 2012 at 1:13 PM

I tried to extend the ExtendedDataGridTemplateColumn and worked for me not from the first time and not the best but I am still new in wpf

This is how I did it

using System;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using ExtendedGrid.Classes;
using ExtendedGrid.Interface;

namespace ExtendedGrid.ExtendedColumn
{
    public class ExtendedDataGridTemplateColumn : DataGridTemplateColumn, IExtendedColumn
    {
        #region Members

        #endregion

        #region "Attached Properties"

        private Boolean allowAutoFilter;
        
        #endregion

        #region Properties



        public Boolean AllowAutoFilter
        {
            get { return allowAutoFilter; }
            set { allowAutoFilter = value; }
        }
        public bool HasAutoFilter
        {
            get
            {
                var header = FindControls.GetColumnHeaderFromColumn(this);
                if (header != null)
                {
                    var popUp = FindControls.FindChild<Popup>(header, "popupDrag");
                    if (popUp != null)
                    {
                        return Convert.ToString(popUp.Tag) == "True";
                    }
                }


                return false;
            }
        }

        #endregion

    }
}