|
Apr
5
Written by:
Jeremiah Morrill
4/5/2009 10:21 PM
 I've created a new custom behavior for WPF that allows for a glass like effect. Essentially you can place this behavior on any Visual, point to to a target visual and give it an effect and it will create an effect that looks like a piece of glass was placed over the screen. You pretty much can make your own Aero effects within your application. . . Usage is simple. The following XAML will create a similar blur effect to the border in the image above: <Border CornerRadius="8,8,8,8">
<i:Interaction.Behaviors>
<local:GlassBehavior Visual="{Binding ElementName=myTargetVisual, Mode=OneWay}">
<local:GlassBehavior.Effect>
<BlurEffect />
local:GlassBehavior.Effect>
local:GlassBehavior>
i:Interaction.Behaviors>
Border>
Tags:
28 comment(s) so far...
Re: Glass Behavior for WPF
http://user.qzone.qq.com/79598188/infocenter?ptlang=2052 I did it too You can in my blog to see it in the album name is WPF you porgram is so good , And a lot of hope that the exchange of, My English not good.There are some problems you can give me some ideas
By puppyWin on
6/8/2009 2:20 AM
|
Re: Glass Behavior for WPF
http://user.qzone.qq.com/79598188/infocenter?ptlang=2052 I did it too You can in my blog to see it in the album name is WPF you porgram is so good , And a lot of hope that the exchange of, My English not good.There are some problems you can give me some ideas
By puppyWin on
6/8/2009 2:20 AM
|
Re: Glass Behavior for WPF
http://user.qzone.qq.com/79598188/infocenter?ptlang=2052 I did it too You can in my blog to see it in the album name is WPF you porgram is so good , And a lot of hope that the exchange of, My English not good.There are some problems you can give me some ideas
By puppyWin on
6/8/2009 2:21 AM
|
Re: Glass Behavior for WPF
Could you tell me that where is the Glashh from? Is it come from Microsoft? The library ShaderEffectLibrary.
By Jackie White on
6/16/2009 12:56 AM
|
Re: Glass Behavior for WPF
You Wrote the ShaderEffectLibrary,right?
By Jackie White on
6/16/2009 12:59 AM
|
Re: Glass Behavior for WPF
No, but you can find it at wpffx.codeplex.com
By Jeremiah Morrill on
6/16/2009 1:12 AM
|
Re: Glass Behavior for WPF
Hello Jeremiah, I am new to WPF and I really like the way this looks and I like to achieve the same but I get: "The attachable property 'Behaviors' was not found in type 'Interaction'." error.
I have done includes to libraries and included your GlassBehavior.cs class.
Please help me to make it work
By ZG on
6/30/2009 12:16 PM
|
Re: Glass Behavior for WPF
Here is my XAML:
By ZG on
6/30/2009 12:22 PM
|
Re: Glass Behavior for WPF
It is not visible :(
By ZG on
6/30/2009 12:23 PM
|
Re: Glass Behavior for WPF
Is there anyway of using this in a window and have the target of the visual set to another window?
By Eric Grover on
9/7/2009 7:43 PM
|
Re: Glass Behavior for WPF
local:GlassBehavior.Effect> local:GlassBehavior> i:Interaction.Behaviors> Border>
By BlAcK-HaCk on
9/10/2009 11:11 PM
|
Re: Glass Behavior for WPF
1.) wpfmediakit.codeplex.com
2.)
3.) ??
4.) Profit! Comments (2)
By BlAcK-HaCk on
9/10/2009 11:12 PM
|
Re: Glass Behavior for WPF
this is something i have been very interested in lately. thanks.
By Hermes-Handbag on
1/5/2010 10:41 PM
|
Re: Glass Behavior for WPF
this is something i have been very interested in lately. thanks.
By Hermes-Handbag on
1/5/2010 10:42 PM
|
Re: Glass Behavior for WPF
Can I make it work with Popup? It said something about Visual Transform cannot be done because it doesn't share the same ancestor as the visual....
By Nat on
1/28/2010 12:19 AM
|
Re: Glass Behavior for WPF
thank you for your great post, and I did want to share this. I hope you will also like it, if you think it is spamming, please kindly delete it. thank you!abercrombie see what is this? abercrombie and fitch uk abercrombie and fitch abercrombie fitch uk abercrombie mens abercrombie london
By abercrombie on
3/11/2010 6:43 AM
|
|
|
ed hardy
ED Hardy Hoodies ED Hardy Hoodies Ed Hardy Swimwear Ed Hardy Swimwear ed hardy tops ed hardy tops ed hardy shoes ed hardy shoes ed hardy t shirt ed hardy t shirt ed hardy shirts ed hardy shirts christian audigier christian audigier ed hardy kids ed hardy kids Ed Hardy Sunglasses Ed Hardy Sunglasses ED Hardy belts ED Hardy belts ed hardy Bags ed hardy Bags ed hardy purse ed hardy purse ed hardy mens ed hardy mens ed hardy womens d hardy womens ed hardy mens shirts ed hardy mens shirts ed hardy mens tops ed hardy mens tops ed hardy mens hoodies d hardy mens hoodies ed hardy mens swim trunks ed hardy mens swim trunks ed hardy mens shoes ed hardy mens shoes ed hardy womens swimwear ed hardy womens swimwear ed hardy womens t shirt ed hardy womens t shirt ed hardy womens tops ed hardy womens tops ed hardy womens pants ed hardy womens pants ed hardy womens hoodies ed hardy womens hoodies ed hardy womens shoes ed hardy womens shoes ed hardy womens clothing ed hardy womens clothing
By ed hardy on
3/15/2010 9:22 PM
|
cheap nike shox
There are wide variety of Nike Shox for both men and women's selection.The Nike Shox Sale are best selling nowadays.Get your own Cheap Nike Shox now.It's definitely time for you to buy womens nike shox and wens nike shox, Wearing them will keep you in a perfect condition.
By nike shox on
3/16/2010 10:13 PM
|
Re: Glass Behavior for WPF
Nice effect!
Btw. nice wallpaper can you give link to it?
By envp on
4/7/2009 2:57 AM
|
Re: Glass Behavior for WPF
Looks nice - but do you have a bit of sourse-code or a sample project such that one can play with this and use it? And how to apply this XAML to a Window? Thanks for offering this insight. And.. what is the painting in the background? I like it - and it seems familiar.
By James Hurst on
4/11/2009 9:09 AM
|
Re: Glass Behavior for WPF
? The full source is linked at the bottom of the post.
By jeremiah Morrill on
4/11/2009 11:01 AM
|
Re: Glass Behavior for WPF
really cool dude !!!!
By Marlon Grech on
4/13/2009 12:37 AM
|
Re: Glass Behavior for WPF
Love the eye candy! Thanks for sharing, Jeremiah :-)
By Philipp on
4/15/2009 3:43 AM
|
Replicating WMP's behavior in WPF
Hi Jeremiah I am coding in WPF these days and trying to develop a WMP like control in WPF. But I have encountered some problems. I posted message to Sacha for that on codeproject and he suggested to me that i should ask you. Here's the scene: I have used mediaelement and slider control to show video and its progress respectively. I also want to provide features like "click to pont" and "slider drag" to change the video position similar to what it is in WMP. While surfing on net i got this solution: --> Use storyboard and media timeline to control video playback of mediaelement. I used storyboard trigger events for start,stop,resume and pause events(in XAML) but how to seek the mediaposition as i cant hardcode the seek's timespan. So i creatred the mediatimeline's clock and assigned it to mediaelement and tried to control the playback. In this case slider's previewmousedown event is used to trap the current slider's position. But 1) When a media clock is explicitly created for mediaelement and used to seek the media playback, the storyboard trigger events stop firing. 2) If Storyboard methods are to be used then Storyboard.Seek(this/mediaelement,offset,beginning) method is not working...i.e. Not Seeking the media's position as per the current slider's position. Am i missing something or doing it in a wrong manner? Any help from your side is highly appreciable. And yes here's my code: (please ignore commented lines as i have tried various combinations)
Here's the XAML file code
Play Pause Stop Resume
Here's the codebehind CS file
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation ; using System.Windows.Media.Imaging; using System.Windows.Shapes; using System.Threading; using System.Windows.Threading;
namespace SampleApplication { /// /// Interaction logic for Window3.xaml /// public partial class Window3 : Window { DispatcherTimer dispatcherTimer = new DispatcherTimer(DispatcherPriority.Background); private static MediaClock mediaclock; private bool sliderdragged = false; public Window3() { InitializeComponent(); dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 1, 0); dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick); //create media clock from mediatimeline and assign it to mediaelement // mediaclock = VideoMediaTimeLine.CreateClock(); // VideoControl.Clock = mediaclock; //VideoControl.Clock.Controller.Stop(); }
private void dispatcherTimer_Tick(object sender, EventArgs e) { TimeSpan ts = new TimeSpan(); if (VideoControl.Clock.CurrentTime.HasValue) { ts = VideoControl.Clock.CurrentTime.Value; ts=VideoControl.Position; } txtTime.Text = ts.Hours + ":" + ts.Minutes + ":" + ts.Seconds;
if (!sliderdragged) { SliderPosition.Value = ts.TotalMilliseconds;
}
}
private void VideoControl_MediaOpened(object sender, RoutedEventArgs e) { if (VideoControl.NaturalDuration.HasTimeSpan && !sliderdragged) {
SliderPosition.Maximum = VideoControl.NaturalDuration.TimeSpan.TotalMilliseconds; VideoMediaTimeLine.Duration = VideoControl.NaturalDuration; }
}
private void btnPlay_Click(object sender, RoutedEventArgs e) { dispatcherTimer.Start(); VideoStoreyBoard.Begin(this, true); // VideoControl.Clock.Controller.Begin();
}
private void btnPause_Click(object sender, RoutedEventArgs e) { //VideoControl.Clock = mediaclock; //VideoControl.Clock.Controller.Pause(); dispatcherTimer.Stop();
}
private void btnStop_Click(object sender, RoutedEventArgs e) {
dispatcherTimer.Stop(); txtTime.Text = "00:00:00"; SliderPosition.Value = 0; /* VideoControl.Clock = mediaclock; VideoControl.Clock.Controller.Stop();*/
} private void btnResume_Click(object sender, RoutedEventArgs e) {
dispatcherTimer.Start(); /* VideoControl.Clock = mediaclock; if (VideoControl.Clock.CurrentState == ClockState.Stopped) { VideoControl.Clock.Controller.Resume(); }*/ }
private void VideoControl_Unloaded(object sender, RoutedEventArgs e) { VideoControl.Close(); }
private void SliderPosition_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e) {
if (VideoControl.NaturalDuration.HasTimeSpan) { dispatcherTimer.Stop(); int SliderValue = (int)SliderPosition.Value; TimeSpan ts = new TimeSpan(0, 0, 0, 0, SliderValue); /*VideoControl.Clock = mediaclock; VideoControl.Clock.Controller.Seek(ts, TimeSeekOrigin.BeginTime);*/ VideoStoreyBoard.Seek(this, ts, TimeSeekOrigin.BeginTime); } sliderdragged = false; dispatcherTimer.Start();
}
private void SliderPosition_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { dispatcherTimer.Stop(); sliderdragged = true;
}
private void VideoControl_MediaEnded(object sender, RoutedEventArgs e) {
dispatcherTimer.Stop();
SliderPosition.Value = 0;
txtTime.Text = "00:00:00";
}
} }
Thanks and regards Rohan
By Rohan on
5/14/2009 12:03 AM
|
Please refer my first message
Here;s my XAML code
Play Pause Stop Resume -->
By Rohan on
5/14/2009 12:08 AM
|
XML data is not getting posted
Hi It seems that my XAML code tags are blocking the page from showing contents. Please tell me which escape tags to be used in order to post the XAML content here.
Thanks
By Rohan on
5/14/2009 12:21 AM
|
|
|
|