This is a migrated thread and some comments may be shown as answers.

What happened to transparency on window drag/move?

3 Answers 132 Views
Window
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 1
Dan asked on 05 Dec 2008, 06:34 PM
I thought that was a slick looking visual.

I was looking to implement it myself, but found it's not currently possible (or at the very least, obvious).

All of the mouse events on the window fire for the content area only so I can't trap it that way (which is normally fine, and I understand you're probably reserving header mouse captures to manage window movement as well as drag/drop).

The closest I can get is to subscribe to LocationChanged and change the opacity there, but there doesn't appear to be an obvious way to detect when the window has stopped moving to restore the opacity back to full.

A property on the window called "OpacityDuringMove" would be nice (to mimic the pre-commercial release).  Or exposing HeaderMouseUp/Down properties so the user could implement it would work too.

Thanks!
Dan

3 Answers, 1 is accepted

Sort by
0
Valeri Hristov
Telerik team
answered on 08 Dec 2008, 10:00 AM

Hi Dan,

In the last moment our designers decided that the windows should not become transparent when they are moved and we dropped that feature. It is actually relatively easy to implement by modifying the control template of RadWindow. Find attached a simple application that demonstrates how to do it.

The main idea is to copy the RadWindow control template to your application or a separate project, modify it and then set RadWindow to use it. Since we still do not provide the templates of the controls in our distribution (we will with SP2, scheduled for the next week), you should follow the steps below:
1) Open Telerik.Windows.Controls.Navigation.dll with Reflector, expand its node, expand Resources, select Telerik.Windows.Navigation.g.resources
2) Right-click on window.xaml from the right hand part of the screen and click Save As... and save the file to the folder of your application.
3) In Visual Studio include the new file in the application.
4) Open Window.xaml and search for "RadWindow_ControlTemplate".
5) Change the "Dragging" visual state and save the file:
<ControlTemplate x:Key="RadWindow_ControlTemplate" TargetType="telerikNavigation:RadWindow">
<ContentControl>
  <vsm:VisualStateManager.VisualStateGroups>
   <vsm:VisualStateGroup x:Name="Animation">
    <vsm:VisualState x:Name="Dragging">
     <Storyboard>
      <DoubleAnimation Storyboard.TargetName="LayoutGrid"
        Storyboard.TargetProperty="(UIElement.Opacity)"
        Duration="0:0:0.2" To="0.5" />
     </Storyboard>
    </vsm:VisualState>

    ...
</ControlTemplate>

6) In the user control where RadWindow is declared add the following:
<UserControl x:Class="SilverlightApplication1.SilverlightControl1"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
  xmlns:telerikNavigation="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation">
 <UserControl.Resources>
  <telerik:Theme Source="/SilverlightApplication1;component/themes/window.xaml"
    x:Key="WindowTheme1" />
 </UserControl.Resources>
 <Grid x:Name="LayoutRoot" Background="White">
  <Button Content="Show window" Click="Button_Click" Width="200" Height="30" />

  <telerikNavigation:RadWindow Width="200" Height="200" x:Name="window1"
    telerik:RadControl.Theme="{StaticResource WindowTheme1}">
  </telerikNavigation:RadWindow>

 </Grid>
</UserControl>

And this is it.

Please, let me know if you have problems running the sample or need additional information.

Sincerely yours,

Valeri Hristov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Dan
Top achievements
Rank 1
answered on 08 Dec 2008, 09:18 PM

Hey Valeri
Thanks for the assistance. I didn't have any luck getting your sample running. 

It was having some parse errors in building the resource.  Once I got around that, I ran into a problem with this part of window.xaml:

    <telerik:ResourceDictionary.MergedDictionaries> 
        <telerik:ResourceDictionary Keys="ButtonStyle  
                                    Collapsed  
                                    Visible  
                                    InputTextBoxStyle  
                                    RadWindowInnerBorder  
                                    RadWindowInnerMostBorder  
                                    RadWindowInnerBackground  
                                    RadWindowOuterBackground  
                                    RadWindowOuterBorder  
                                    BorderOuterBrush  
                                    BorderInnerBrush  
                                    InputTextBoxBackground  
                                    "  
                Source="/Telerik.Windows.Controls;component/Themes/Common.xaml" /> 
    </telerik:ResourceDictionary.MergedDictionaries> 

It doesn't appear to be able to access the Keys in the specified Telerik assembly. (I get a bad property exception)

Perhaps those values do not provide access outside of the Telerik assembly?
0
Valeri Hristov
Telerik team
answered on 09 Dec 2008, 12:28 PM
Hello Dan,

I suppose that you are using different version of the assemblies than the one that I used for the example. I used the distribution with the CTP of RadGridView for Silverlight and I suppose that if you upgrade to that version the example will run without errors.

If you cannot run my example using any of the RadControls assemblies you have, I suggest following the steps I provided and recreating the example manually.

Kind regards,
Valeri Hristov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Window
Asked by
Dan
Top achievements
Rank 1
Answers by
Valeri Hristov
Telerik team
Dan
Top achievements
Rank 1
Share this question
or