Hi,
I'm trying to get the Office 2010 look & feel so i'd like to apply glass effect on the RadRibbonWindow, wich works fine with a standard window (http://msdn.microsoft.com/en-us/library/ms748975.aspx).
Have you already set a handler that would prevent that feature to work ?
Regards.
I'm trying to get the Office 2010 look & feel so i'd like to apply glass effect on the RadRibbonWindow, wich works fine with a standard window (http://msdn.microsoft.com/en-us/library/ms748975.aspx).
Have you already set a handler that would prevent that feature to work ?
Regards.
<
telerik:RadRibbonWindow
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
x:Class
=
"TestRibbon.MainWindow"
Title
=
"MainWindow"
Height
=
"350"
Width
=
"525"
Loaded
=
"Window_Loaded"
Background
=
"Transparent"
>
</
telerik:RadRibbonWindow
>
public
partial
class
MainWindow : RadRibbonWindow
{
public
MainWindow()
{
InitializeComponent();
}
private
void
Window_Loaded(
object
sender, RoutedEventArgs e)
{
try
{
IntPtr mainWindowPtr =
new
WindowInteropHelper(
this
).Handle;
HwndSource mainWindowSrc = HwndSource.FromHwnd(mainWindowPtr);
mainWindowSrc.CompositionTarget.BackgroundColor = Color.FromArgb(0, 0, 0, 0);
System.Drawing.Graphics desktop = System.Drawing.Graphics.FromHwnd(mainWindowPtr);
float
DesktopDpiX = desktop.DpiX;
float
DesktopDpiY = desktop.DpiY;
MARGINS margins =
new
MARGINS();
margins.cxLeftWidth = Convert.ToInt32(0 * (DesktopDpiX / 96));
margins.cxRightWidth = Convert.ToInt32(
this
.Width * (DesktopDpiX / 96));
margins.cyTopHeight = Convert.ToInt32(0 * (DesktopDpiX / 96));
margins.cyBottomHeight = Convert.ToInt32(
this
.Height * (DesktopDpiX / 96));
int
hr = DwmExtendFrameIntoClientArea(mainWindowSrc.Handle,
ref
margins);
if
(hr < 0)
{
MessageBox.Show(
"Can't apply glass..."
);
}
}
catch
(DllNotFoundException)
{
Application.Current.MainWindow.Background = Brushes.White;
}
}
[StructLayout(LayoutKind.Sequential)]
public
struct
MARGINS
{
public
int
cxLeftWidth;
public
int
cxRightWidth;
public
int
cyTopHeight;
public
int
cyBottomHeight;
};
[DllImport(
"DwmApi.dll"
)]
public
static
extern
int
DwmExtendFrameIntoClientArea(
IntPtr hwnd,
ref
MARGINS pMarInset);
}