This is a migrated thread and some comments may be shown as answers.

Extends RadGrid

1 Answer 92 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jocelyn
Top achievements
Rank 1
Jocelyn asked on 11 Jun 2012, 01:55 PM
Hi,

my problem is a little bit tricky. I will try to explain it as clear as I can.

I am using alot of grid in my application. For the moment I have a function called UpdateDefault which looks like this:

Public Sub GridCGSI_UpdateDefaults(ByVal tmpGrid As RadGrid)
    AddHandler tmpGrid.HeaderContextMenu.ItemCreated, AddressOf GridCGSI_HeaderContextMenu_ItemCreated
 
 
    tmpGrid.CellSpacing = "0"
    tmpGrid.AutoGenerateColumns = False
    tmpGrid.AllowPaging = True
    tmpGrid.PageSize = 40
    tmpGrid.AllowSorting = True
 
    tmpGrid.GridLines = GridLines.None
    tmpGrid.AllowFilteringByColumn = True
    tmpGrid.EnableHeaderContextMenu = True
    tmpGrid.ShowStatusBar = True
 
    tmpGrid.HeaderContextMenu.Enabled = True
 
 
    tmpGrid.GroupingSettings.CaseSensitive = False
    tmpGrid.ClientSettings.AllowColumnHide = True
    tmpGrid.ClientSettings.AllowColumnsReorder = True
    tmpGrid.ClientSettings.AllowKeyboardNavigation = True
    tmpGrid.ClientSettings.EnableRowHoverStyle = True
    tmpGrid.ClientSettings.Selecting.AllowRowSelect = True
    tmpGrid.ClientSettings.Scrolling.AllowScroll = True
    tmpGrid.ClientSettings.Scrolling.UseStaticHeaders = True
    tmpGrid.ClientSettings.Resizing.AllowColumnResize = True
    tmpGrid.ClientSettings.Resizing.AllowResizeToFit = True
    tmpGrid.ClientSettings.Resizing.EnableRealTimeResize = True
 
    tmpGrid.FilterMenu.EnableImageSprites = False
 
    tmpGrid.SortingSettings.SortedAscToolTip = "Trié asc"
    tmpGrid.SortingSettings.SortedDescToolTip = " desc"
    tmpGrid.SortingSettings.SortToolTip = "Cliquez ici pour trier"
    tmpGrid.StatusBarSettings.LoadingText = "Chargement..."
    tmpGrid.StatusBarSettings.ReadyText = GetMessageEx(3282).Texte
 
    tmpGrid.GroupingSettings.CaseSensitive = False
 
    tmpGrid.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric
 
 
    tmpGrid.MasterTableView.TableLayout = GridTableLayout.Fixed
    tmpGrid.MasterTableView.EnableHeaderContextAggregatesMenu = "True"
    tmpGrid.MasterTableView.NoMasterRecordsText = "Aucun enregistrement à afficher"
    tmpGrid.MasterTableView.EditFormSettings.EditColumn.ButtonType = GridButtonColumnType.PushButton
    tmpGrid.MasterTableView.EditFormSettings.EditColumn.UpdateImageUrl = "Images/Icons/055-Check-ok-Icon.png"
    tmpGrid.MasterTableView.EditFormSettings.EditColumn.CancelImageUrl = "Images/Icons/056-Check-not-ok-Icon.png"
    tmpGrid.MasterTableView.EditFormSettings.EditColumn.InsertImageUrl = "Images/Icons/055-Check-ok-Icon.png"
    tmpGrid.MasterTableView.EditFormSettings.EditColumn.CancelText = GetMessageEx(5352).Texte
    tmpGrid.MasterTableView.EditFormSettings.EditColumn.UpdateText = GetMessageEx(4479).Texte
    tmpGrid.MasterTableView.EditFormSettings.EditColumn.InsertText = GetMessageEx(3177).Texte
    tmpGrid.MasterTableView.CommandItemSettings.AddNewRecordText = GetMessageEx(3177).Texte
    tmpGrid.MasterTableView.CommandItemSettings.RefreshText = "Rafraîchir"
End Sub

As you can see, I am settings some default settings for my grid. The best way it would be to put this in the grid constructor.

I am not familiar with custom user control. I know I can create a class and inherits from RadGrid and extend the constructor, but I don't know how I can implement this in the xaml and use it properly in code behind.

I need your help Telerik! Could you make me a little Project Sample with an example?

Regards,

- Jocelyn

1 Answer, 1 is accepted

Sort by
0
Jocelyn
Top achievements
Rank 1
answered on 18 Jun 2012, 12:10 PM
Nobody can help me? Maybe my question needs more information?
Tags
Grid
Asked by
Jocelyn
Top achievements
Rank 1
Answers by
Jocelyn
Top achievements
Rank 1
Share this question
or