locked
Blend 4 Click event RRS feed

  • Question

  • Hy!

    There is a button, but there isn't click event.
    How do I set that? 

    button can be downloaded
    http://www.mediafire.com/?t6qffqldcw9lz6r

    (import Visual Studio c#)
    • Edited by csepcsavo Thursday, March 1, 2012 7:13 PM
    Thursday, March 1, 2012 6:57 PM

All replies

  • Hey Ccepcsavo.

    You could right-click and convert it to a control/button.

    Or add a mouseLeftButtonDown event to it.

    Or maybe contact them and find out if it was really supposed to be a button or just an image of one?

    Did you rebuild your project after adding the controls's dll to your project?

    ~Christine

    Thursday, March 1, 2012 7:24 PM
  • I'm not sure what you are asking, can you clarify?
    Thursday, March 1, 2012 8:33 PM
    Moderator
  • I'm not sure what you are asking, can you clarify?
    <UserControl
    	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    	mc:Ignorable="d"
    	x:Class="kilepes.MainControl"
    	x:Name="UserControl"
    	d:DesignWidth="640" d:DesignHeight="480" Width="80" Height="34">
    	<UserControl.Resources>
    		<ControlTemplate x:Key="GlassButton3" TargetType="{x:Type Button}">
    			<ControlTemplate.Resources>
    				<Storyboard x:Key="Timeline1">
    					<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="glow" Storyboard.TargetProperty="(UIElement.Opacity)">
    						<SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="1"/>
    					</DoubleAnimationUsingKeyFrames>
    				</Storyboard>
    				<Storyboard x:Key="Timeline2">
    					<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="glow" Storyboard.TargetProperty="(UIElement.Opacity)">
    						<SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0"/>
    					</DoubleAnimationUsingKeyFrames>
    				</Storyboard>
    			</ControlTemplate.Resources>
    			<Border BorderBrush="#FFFFFFFF" BorderThickness="1,1,1,1" CornerRadius="4,4,4,4">
    				<Border x:Name="border" Background="#7F000000" BorderBrush="#FF000000" BorderThickness="1,1,1,1" CornerRadius="4,4,4,4">
    					<Grid x:Name="grid">
    						<Grid.Background>
    							<ImageBrush ImageSource="buttons3.png"/>
    						</Grid.Background>
    						<Grid.RowDefinitions>
    							<RowDefinition Height="0.507*"/>
    							<RowDefinition Height="0.493*"/>
    						</Grid.RowDefinitions>
    						<Border Opacity="0" HorizontalAlignment="Stretch" x:Name="glow" Width="Auto" Grid.RowSpan="2" CornerRadius="4,4,4,4">
    							<Border.Background>
    								<ImageBrush ImageSource="buttons4.png"/>
    							</Border.Background>
    						</Border>
    						<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Width="Auto" Grid.RowSpan="2"/>
    					</Grid>
    				</Border>
    			</Border>
    			<ControlTemplate.Triggers>
    				<EventTrigger RoutedEvent="UIElement.MouseLeftButtonDown" SourceName="glow"/>
    				<Trigger Property="IsPressed" Value="True">
    					<Setter Property="Background" TargetName="border" Value="#CC000000"/>
    					<Setter Property="Visibility" TargetName="glow" Value="Hidden"/>
    				</Trigger>
    				<Trigger Property="IsMouseOver" Value="True">
    					<Trigger.EnterActions>
    						<BeginStoryboard Storyboard="{StaticResource Timeline1}"/>
    					</Trigger.EnterActions>
    					<Trigger.ExitActions>
    						<BeginStoryboard x:Name="Timeline2_BeginStoryboard" Storyboard="{StaticResource Timeline2}"/>
    					</Trigger.ExitActions>
    				</Trigger>
    			</ControlTemplate.Triggers>
    		</ControlTemplate>
    	</UserControl.Resources>
    
    	<Grid x:Name="LayoutRoot">
    		<Button x:Name="button" VerticalAlignment="Top" Height="34" Content="Kilépés" Template="{DynamicResource GlassButton3}" FontFamily="BatmanForeverAlternate" IsCancel="True" Width="80" HorizontalAlignment="Left" d:LayoutOverrides="VerticalAlignment">
    			<Button.Foreground>
    				<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
    					<GradientStop Color="#FF35AFFD" Offset="0"/>
    					<GradientStop Color="#FF00F0FF" Offset="1"/>
    				</LinearGradientBrush>
    			</Button.Foreground>
    		</Button>
    	</Grid>
    </UserControl>

    I would like a normal button. I think the click is required for this event.

    Friday, March 2, 2012 5:28 PM
  • You appear to have a "normal button", what are you trying and what is not working? Your <Button> instance could have a Click event handler.
    Friday, March 2, 2012 5:31 PM
    Moderator