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">
Hi Gergana,
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 cfosterj,
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.
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 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.
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?