In v19.2 and earlier versions, the IWindowService and ICurrentWindowService interfaces contained the SetWindowState method, which has a parameter of the WindowState type. This type is located in the PresentationFramework assembly:
C#public interface IWindowService {
...
void SetWindowState(WindowState state);
}
public interface ICurrentWindowService {
...
void SetWindowState(WindowState state);
}
Visual BasicPublic Interface IWindowService
...
Sub SetState(ByVal state As WindowState)
End Interface
Public Interface ICurrentWindowService
...
Sub SetState(ByVal state As WindowState)
End Interface
This issue prevented us from implementing IWindowService/ICurrentWindowService for the Windows Forms platform. In v20.1, we have changed these interfaces to fix the issue. A new WindowState property is now used to specify the state of a window:
C#public enum DXWindowState { Normal = 0, Minimized = 1, Maximized = 2 }
public interface IWindowService {
...
DXWindowState WindowState { get; set; }
}
public interface ICurrentWindowService {
...
DXWindowState WindowState { get; set; }
}
[EditorBrowsable(EditorBrowsableState.Never)]
public static class WindowServicePlatformExtensions {
[EditorBrowsable(EditorBrowsableState.Never)]
public static void SetWindowState(this IWindowService service, WindowState state) {
...
}
}
[EditorBrowsable(EditorBrowsableState.Never)]
public static class CurrentWindowServicePlatformExtensions {
[EditorBrowsable(EditorBrowsableState.Never)]
public static void SetWindowState(this ICurrentWindowService service, WindowState state) {
...
}
}
Visual BasicPublic Enum DXWindowState
Normal = 0
Minimized = 1
Maximized = 2
End Enum
Public Interface IWindowService
...
Property WindowState As DXWindowState
End Interface
Public Interface ICurrentWindowService
...
Property WindowState As DXWindowState
End Interface
<EditorBrowsable(EditorBrowsableState.Never)>
Public Module WindowServicePlatformExtensions
<Extension()>
<EditorBrowsable(EditorBrowsableState.Never)>
Public Sub SetWindowState(ByVal service As IWindowService, ByVal state As WindowState)
...
End Sub
End Module
<EditorBrowsable(EditorBrowsableState.Never)>
Public Module CurrentWindowServicePlatformExtensions
<Extension()>
<EditorBrowsable(EditorBrowsableState.Never)>
Public Sub SetWindowState(ByVal service As ICurrentWindowService, ByVal state As WindowState)
...
End Sub
End Module
The old SetWindowState method is available as an extension method. This method is hidden from Visual Studio IntelliSense with the EditorBrowsable(EditorBrowsableState.Never) attribute. If you encounter the "Method not found" error, make sure you referenced the DevExpress.Mvvm namespace:
C#using DevExpress.Mvvm;
Visual BasicImports DevExpress.Mvvm
If you need to convert a WindowState object to the DXWindowState type and vice-versa, use the static DevExpress.Mvvm.DXWindowStateConverter class. Note that this class is also hidden from Visual Studio IntelliSense.