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>
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.
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 was really helpful. One quick question In your sample as the styles are on the same form as button click event it is able to get the resources, for me there is one form(host container) which adds another form which will have stylePanel.
So should I add the styles on host container usercontrol or the other usercontrol which is added dynamically.
2nd question, when I put the style on host container usercontrol, I am not able to resolve following line, as it can't find Resources in the namespace. I tried to check in your solution but can't really get what I am missing. One thing is my code is in ViewModel not in codebehind
Resources["ContentPaneStyle"] as Style
I have been looking into your question and have modified the sample application for you. I have placed the styles for the ContentPane in the App.xaml file. Then I have modified the line where the style is applied as follows:
myPane.Style = Application.Current.Resources["ContentPaneStyle"] as Style;
This way the style can be used for every user control.
Please find the modified sample application and feel free to let me know if you have any further questions on this matter.
Really really appreciate your quick response. I am somehow struggling I am getting null for following statement:
Application.Current.Resources["ContentPaneStyle"] as Style
I followed the same approach as you, my style is in App.xaml & then use that in ViewModel for host container:
Sample code for host container is : Any idea where I am going wrong?
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;
}
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.
Please do not hesitate to let me know if you have any further questions on this matter.
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.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.