I have a requirement that my content pane should not be movable, currently user is able to drag the control & move over the form & dock it wherever he want.
So far I have tried following options, but none of them worked.
IsFloating=False
AllowDockingFloating=False
AllowDocking=False
<ig:ContentPanex:Name="WorkspacesPane"IsFloating="False"AllowDockingFloating="False"IsMaximized="False"AllowDocking="False"Header="Workspaces"Location="Left"Height="Auto"Width="Auto"MinWidth="250"IsActivePane="True"CloseButtonVisibility="Collapsed"WindowPositionMenuVisibility="Collapsed">
Hello cfosterj,
Thank you for your post.
I have been looking into it and I have some questions regarding your scenario. Are you placing the ContentPanes inside of a DocumentContentHost or you put them in the XamDockManager.Panes?
Thank you in advance for the provided in formation. Looking forward to hearing from you.
Thanks Gergana. It's inside XamDockManager.Panes. Here is sample Xaml:
<ig:XamDockManager.Panes>
<ig:ContentPane x:Name="WorkspacesPane" IsHitTestVisible="False" AllowDocking="False" DragOver="WorkspacesPane_OnDragOver" Header="Workspaces" Location="Left" Height="Auto" Width="Auto" MinWidth="250" IsActivePane="True" CloseButtonVisibility="Collapsed" WindowPositionMenuVisibility="Collapsed">
<ContentControl prism:RegionManager.RegionName="WorkspacesRegion" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch"> </ContentControl> </ig:ContentPane> </ig:XamDockManager.Panes>
I have been looking into your issue and I have created a small sample application for you. In the sample I have used the default style for the ContentPane. There I set the IsHitTestVisible property of the DockPaneHeader to false. This way the user cannot click on the Header of the ContentPane and can change the content in the pane.
Please find the attached sample application and feel free to let me know if you have any further questions on this matter.
Hi Gergana,
That helped for one of my control who was loaded at design time. But for one control it is added dynamically, how would I apply these styles at runtime?
Sample code :
foreach (StatusModuleItem statusModuleItem in statusModuleItems) { if (accessRights.ContainsKey(statusModuleItem.ID)) { long accessRight = accessRights[statusModuleItem.ID];
if (accessRight != Convert.ToInt32(AccessRights.None)) { ContentPane statusModulePane = new ContentPane(); statusModulePane.DataContext = statusModuleItem; statusModulePane.Header = statusModuleItem.Header;
I have been looking into your issue. What I can suggest is to set a Key for the style for the ContentPane. Then when you create the ContentPane you can assign this key to the style proeprty of the ContentPane.
Here is an example:
ContentPane statusModulePane = new ContentPane();statusModulePane.DataContext = statusModuleItem;statusModulePane.Header = statusModuleItem.Header;
statusModulePane.Style = Resources["StyleKey"] as Style;
Please do not hesitate to let me know if you have any further questions on this matter.
Also when the control is added dynamically, how are you going to name the styles, they have to exist at design time isn't it?
I have been looking into your issue and have modified the last attached sample application. In the modified sample I am creating a ContentPane on a button click and assign the style for it as I have mentioned in my previous post.
Hello,
I have removed the key, attribute, & I didn't get when you say to remove the style assignment.
To answer your question, no there are no further styles to content pane & the content pane is added dynamically.
Here is the dynamic adding code :
Xaml removed key code :
<Style TargetType="ig:ContentPane" x:Name="ContentPaneStyle">
Dynamic adding the control:
if (accessRight != Convert.ToInt32(AccessRights.None)) { ContentPane statusModulePane = new ContentPane(); if(statusModuleItem.Header.Equals("Alerts")) { statusModulePane.Style = Application.Current.Resources["ContentPaneStyle"] as Style; //statusModulePane.IsHitTestVisible = false; } statusModulePane.DataContext = statusModuleItem; statusModulePane.Header = statusModuleItem.Header; Type contentViewType = Type.GetType(statusModuleItem.ContentView + "," + statusModuleItem.AssemblyName); try { statusModulePane.Content = serviceLocator.GetInstance(contentViewType); regionManager.RegisterViewWithRegion(statusModuleItem.Region, () => statusModulePane); this.statusModulePanes.Add(statusModulePane); } catch (Exception ex) { publishBootstrapEvent("Error loading " + contentViewType.FullName + " module:" + ex.ToString()); } }
I am just checking if you have any further questions on this matter. Please do not hesitate to let me know if you do.
I have been looking into your issue. Would you please try to remove the key for the ContentPane style in the App.xaml file. The style is the following: <Style TargetType="ig:ContentPane">
Then you have to remove the style assignment.
One other question – do you have other styles for the content pane? If you do have styles in the resources, where the ContentPane is created – those styles would be assigned to the ContentPane and not the once in the App.xaml file.
Unfortunately it's a huge application which I am working on. I copied the styles into main project app.xaml then I don't get Application.Current.Resources["ContentPaneStyle"] as Style as null. But it doesn't work I can still move the contentpane. While it worked for one of the form where contentPane was static not added dynamically.
Basically to give you hint : I have one silverlight project called as workspace, another project AlertPanel.
ViewModel of Workspace project adds the assembly of AlertPanel dynamically using following code(here I associate the style dynamically to content pane)
foreach (StatusModuleItem statusModuleItem in statusModuleItems){if (accessRights.ContainsKey(statusModuleItem.ID)){long accessRight = accessRights[statusModuleItem.ID];
if (accessRight != Convert.ToInt32(AccessRights.None)){ContentPane statusModulePane = new ContentPane();if(statusModuleItem.Header.Equals("Alerts")){
statusModulePane.Style = Application.Current.Resources["ContentPaneStyle"] as Style;
//statusModulePane.IsHitTestVisible = false;}
I have been looking into your issue. Would you please modify the last attached sample application with the functionality you are using, in order for the to reproduce the issue and further research it.
Thank you in advance for the cooperation. Looking forward to hearing from you.