Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Trigger in XAML (Read 2457 times)
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Trigger in XAML
Apr 20th, 2009 at 5:42am
Print Post  
Hi,

I have created a node in a xaml file.Now I want to apply some triggers on that node to perform verious operation like NodeClicked,MouseOver,MouseEnter,OnMouseWheel etc.How can I do that ?

I have used following code in xaml.
Code
Select All
<Window x:Class="ResourcesInXAML.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="clr-namespace:MindFusion.Diagramming.Wpf;assembly=MindFusion.Diagramming.Wpf"
    Title="Resources In XAML" Height="150" Width="300"
    >


  <d:ShapeNode Bounds="100,100,100,100" Brush="Blue" Text="hello"></d:ShapeNode>

  </Window> 



  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Trigger in XAML
Reply #1 - Apr 20th, 2009 at 10:59am
Print Post  
Hi,

<d:ShapeNode MouseEnter="OnNodeMouseEnter"  Bounds="100,100,100,100" Brush="Blue" Text="hello"></mf:ShapeNode>

worked for me.

Stoyan
  
Back to top
 
IP Logged
 
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Re: Trigger in XAML
Reply #2 - Apr 20th, 2009 at 2:21pm
Print Post  
Hi Stoyan,

It was not my question.I want to call a trigger event on that perticular action.

I am sending you a snippet for a button control, Same i want for ShapeNode.
Code
Select All
<Window x:Class="ResourcesInXAML.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Resources In XAML" Height="150" Width="300">

    <Window.Resources>
	  <Style x:Key="myStyle">
		<Style.Triggers>
		    <Trigger Property="Control.IsMouseOver" Value="True">
			  <Setter Property="Control.Background" Value="Red" />
		    </Trigger>
		</Style.Triggers>
	  </Style>
    </Window.Resources>
    <StackPanel Margin="30">
	  <Button Style="{StaticResource myStyle}"
		Width="200" Height="40">
		ASP Alliance
	  </Button>
    </StackPanel>
</Window> 

  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Trigger in XAML
Reply #3 - Apr 21st, 2009 at 9:37am
Print Post  
Seems events cannot be attached through styles. The Style property is defined in FrameworkElement, while DiagramItem inherits UIElement, and does not support it.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint