This question is locked. New answers and comments are not allowed.
Hi,
I am using Docking control in My Dashboard. There are 5 different grid and scheduler etc...
Now I am binding menu into all diffrenet GridView at runtime. It done perfectly without any error.
But my problem is When I LoadLayout and then binde Menu into GridView it does not show any menu into GridView and does not show me any error. Lay out restore perfectly.
Now If I bind Menu into GridView first and then load layout (LoadLayout) it give me error.
Error HRESULT E_FAIL has been returned from a call to a COM component.
and Lay out does not restore. Some time it does not give me the error but if I try to dock any girdview or item it gives me Catastrophy error.
Binding Menu
I havae post same problem on Docking Forum.
Thanks,
Gaurang
I am using Docking control in My Dashboard. There are 5 different grid and scheduler etc...
Now I am binding menu into all diffrenet GridView at runtime. It done perfectly without any error.
But my problem is When I LoadLayout and then binde Menu into GridView it does not show any menu into GridView and does not show me any error. Lay out restore perfectly.
Now If I bind Menu into GridView first and then load layout (LoadLayout) it give me error.
Error HRESULT E_FAIL has been returned from a call to a COM component.
and Lay out does not restore. Some time it does not give me the error but if I try to dock any girdview or item it gives me Catastrophy error.
Binding Menu
here gv = GridView gv.Columns.AddRange(new CrmActivityController().GridViewColumns); gv.Columns.Remove(gvCalls.Columns[CurrentLanguage.CrmActivity.LBLTYPE.ToString()]); GridViewHeaderMenu.SetIsEnabled(gv, true); gv.Columns.Remove(gvCalls.Columns["DefaultContact.Account"]); gv.Columns.Remove(gvCalls.Columns["DefaultContact.FullName"]);-----------------------------------------------------------------------------public class GridViewHeaderMenu { public static readonly DependencyProperty IsEnabledProperty = DependencyProperty.RegisterAttached("IsEnabled", typeof(bool), typeof(CrmGridViewHeaderMenu), new System.Windows.PropertyMetadata(new PropertyChangedCallback(OnIsEnabledPropertyChanged))); private GridView grid = null; public GridViewHeaderMenu(GridView grid) { this.grid = grid; } public static void SetIsEnabled(DependencyObject dependencyObject, bool enabled) { dependencyObject.SetValue(IsEnabledProperty, enabled); } public void Attach() { if (grid != null) { grid.RowLoaded += new EventHandler<RowLoadedEventArgs>(RowLoaded); } } private static void OnIsEnabledPropertyChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e) { GridView grid = dependencyObject as GridView; if (grid != null) { if ((bool) e.NewValue) { GridViewHeaderMenu menu = new GridViewHeaderMenu(grid); menu.Attach(); } } } private void RowLoaded(object sender, RowLoadedEventArgs e) { if (e.Row is GridViewHeaderRow) { InitializeMenus((GridViewHeaderRow) e.Row); } } private void InitializeMenus(GridViewHeaderRow row) { RadMenuItem item = new RadMenuItem() { Header = "Choose Columns:" }; contextMenu.Items.Add(item); foreach (GridViewColumn column in grid.Columns) { RadMenuItem subMenu = new RadMenuItem() { Header = column.Header, IsCheckable = true, IsChecked = true }; subMenu.SetBinding(RadMenuItem.IsCheckedProperty, new Binding("IsVisible") { Mode = BindingMode.TwoWay, Source = column }); item.Items.Add(subMenu); } contextMenu.AddHandler(RadMenuItem.ClickEvent, new RoutedEventHandler(OnMenuItemClick)); RadContextMenu.SetContextMenu(grid, contextMenu); } }private void OnMenuItemClick(object sender, RoutedEventArgs e) {}}}I havae post same problem on Docking Forum.
Thanks,
Gaurang