Click here to Skip to main content
15,895,667 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: hierarchical data grid in silverlight Pin
Abhinav S5-Nov-10 19:03
Abhinav S5-Nov-10 19:03 
GeneralRe: hierarchical data grid in silverlight Pin
C-sharper 110-Nov-10 0:04
C-sharper 110-Nov-10 0:04 
AnswerRe: hierarchical data grid in silverlight Pin
RugbyLeague11-Nov-10 5:42
RugbyLeague11-Nov-10 5:42 
QuestionTreeview - XML - HierarchicalDataTemplate Pin
RugbyLeague5-Nov-10 6:20
RugbyLeague5-Nov-10 6:20 
AnswerRe: Treeview - XML - HierarchicalDataTemplate Pin
RugbyLeague7-Nov-10 22:13
RugbyLeague7-Nov-10 22:13 
GeneralRe: Treeview - XML - HierarchicalDataTemplate Pin
Kevin Marois11-Nov-10 5:38
professionalKevin Marois11-Nov-10 5:38 
GeneralRe: Treeview - XML - HierarchicalDataTemplate Pin
RugbyLeague11-Nov-10 5:39
RugbyLeague11-Nov-10 5:39 
QuestionEye that follow cursor of the mouse Pin
VisualLive4-Nov-10 23:59
VisualLive4-Nov-10 23:59 
Hi ,
i wish build a control(wpf) that the Eye(Ellipse) follow the cursor of the mouse.
here is a snippet code that i am developing :

XML
<Window Height="480" Title="Window2" Width="640" x:Class="WpfApplication5.Window2"
     x:Name="Window" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Window.Resources>
<Storyboard x:Key="OnLoaded1">
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="ctrCircle" 
    Storyboard.TargetProperty="(UIElement.RenderTransform).( TransformGroup.Children)[3].(TranslateTransform.X)">
<EasingDoubleKeyFrame KeyTime="0:0:0.8" Value="1">
<EasingDoubleKeyFrame.EasingFunction>
<ExponentialEase EasingMode="EaseOut" />
</EasingDoubleKeyFrame.EasingFunction>
</EasingDoubleKeyFrame>
        </DoubleAnimationUsingKeyFrames>
        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="ctrCircle" 
            Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
                <EasingDoubleKeyFrame KeyTime="0:0:0.8" Value="1">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <ExponentialEase EasingMode="EaseOut" />
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>
        <Style TargetType="Ellipse">
       <Setter Property="RenderTransform">
            <Setter.Value>
                <ScaleTransform ScaleX="1" ScaleY="1"/>
           </Setter.Value>
        </Setter>
       <Setter Property="RenderTransformOrigin" Value="0.5,0.5"/>
    </Style>
    </Window.Resources>
 <Canvas MouseMove="mov" x:Name="LayoutRoot">
    <Border ackground="Black" B="" Canvas.Left="178" Canvas.Top="103" 
        CornerRadius="250" Height="255.5" Width="290" x:Name="border_eye">
        <Ellipse Fill="#FFFFC600" Height="12" HorizontalAlignment="Left" 
            Margin="0" RenderTransformOrigin="0.5,0.5" Stroke="{x:Null}" 
            VerticalAlignment="Center" Visibility="Visible" Width="12" x:Name="ctrCircle">
            <Ellipse.RenderTransform>
                <TransformGroup>
                     <ScaleTransform />
                    <SkewTransform />
                    <RotateTransform />
                    <TranslateTransform />                 
                </TransformGroup>
            </Ellipse.RenderTransform>
        </Ellipse>
    </Border>
</Canvas>
</Window>



and in the code behind :
C#
private void mov(object sender, MouseEventArgs e)
        {
	 System.Windows.Point pt = e.GetPosition((Canvas)sender);
          Storyboard invokeStoryboard = this.Resources["OnLoaded1"] as Storyboard;
            ((DoubleAnimationUsingKeyFrames)invokeStoryboard.Children[0]).KeyFrames[0].Value = pt.X;
            ((DoubleAnimationUsingKeyFrames)invokeStoryboard.Children[1]).KeyFrames[0].Value = pt.Y;
            invokeStoryboard.Begin();
        }


now my purpose is when i move the mouse in the Canvas area(LayoutRoot) the Ellipse(ctrCircle) move only inside the Border(border_eye) and don't overcome the area of the "border_eye" this effect is similar an eye.

Do you have any idea how to perform this step?

Thanks so much for your attention Smile | :)

Have a nice day.
Question2 web sites 1 source of uploads Pin
Mycroft Holmes4-Nov-10 17:50
professionalMycroft Holmes4-Nov-10 17:50 
AnswerRe: 2 web sites 1 source of uploads Pin
AspDotNetDev4-Nov-10 18:05
protectorAspDotNetDev4-Nov-10 18:05 
GeneralRe: 2 web sites 1 source of uploads Pin
Mycroft Holmes4-Nov-10 20:38
professionalMycroft Holmes4-Nov-10 20:38 
GeneralRe: 2 web sites 1 source of uploads Pin
AspDotNetDev5-Nov-10 16:52
protectorAspDotNetDev5-Nov-10 16:52 
GeneralRe: 2 web sites 1 source of uploads Pin
Mycroft Holmes5-Nov-10 18:52
professionalMycroft Holmes5-Nov-10 18:52 
GeneralRe: 2 web sites 1 source of uploads Pin
AspDotNetDev5-Nov-10 19:05
protectorAspDotNetDev5-Nov-10 19:05 
AnswerRe: 2 web sites 1 source of uploads Pin
#realJSOP5-Nov-10 2:51
mve#realJSOP5-Nov-10 2:51 
GeneralRe: 2 web sites 1 source of uploads Pin
Mycroft Holmes5-Nov-10 3:22
professionalMycroft Holmes5-Nov-10 3:22 
QuestionValidation Pin
eddieangel3-Nov-10 12:13
eddieangel3-Nov-10 12:13 
Questiondefault button height? Pin
SledgeHammer013-Nov-10 10:02
SledgeHammer013-Nov-10 10:02 
AnswerRe: default button height? Pin
Nish Nishant3-Nov-10 11:30
sitebuilderNish Nishant3-Nov-10 11:30 
QuestionNeed information about GetStylesWithTargetType Pin
mtproc3-Nov-10 9:16
mtproc3-Nov-10 9:16 
AnswerRe: Need information about GetStylesWithTargetType Pin
mtproc4-Nov-10 5:50
mtproc4-Nov-10 5:50 
QuestionListView Inside TreeListView Pin
krishnan.s3-Nov-10 5:57
krishnan.s3-Nov-10 5:57 
AnswerRe: ListView Inside TreeListView Pin
Kevin Marois11-Nov-10 5:39
professionalKevin Marois11-Nov-10 5:39 
QuestionBinding with converter doesn't work. System.Windows.Data.Binding' cannot be converted to type 'System.Windows.Media.Brush'. Pin
ananddayalan2-Nov-10 19:55
ananddayalan2-Nov-10 19:55 
AnswerRe: Binding with converter doesn't work. System.Windows.Data.Binding' cannot be converted to type 'System.Windows.Media.Brush'. Pin
Abhinav S2-Nov-10 21:54
Abhinav S2-Nov-10 21:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.