Gamepad_Accept not calling click events
Posted: 24 Jul 2019, 08:39
Im trying to do a very basic click a button and run a function, the function works with the mouse and has no problem. but every time i try to use a gamepad it does not pick up the input, im not to sure what I am doing wrong.
I have a simple button
The button also has a style for triggers
This is the code that handles the click event and runs the function, within that function I get it run code (its a comment here, but I throw an exception every time to make sure it is working)
I also use the input mapper from the official documentation.
https://www.noesisengine.com/docs/2.2/G ... ml#gamepad
I would like to know if there is a reason behind this, or rather do I have to use certain event names, or certain triggers to get the A button on an Xbox controller calling the same as a mouse click.
I have a simple button
Which simple calls the click event.<Button x:Name="SPP_FreeSurfButton" Content="Button" Width="524" FontSize="72" Click="SPP_FreeSurfButton"/>
The button also has a style for triggers
Code: Select all
<Style x:Key="MainButtonStyle" TargetType="{x:Type Button}">
<Setter Property="Background" Value="{StaticResource Menu.Button.Static.Background}"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Padding" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
<ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" TargetName="border" Value="{StaticResource Menu.Button.MouseOver.Background}"/>
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Background" TargetName="border" Value="{StaticResource Menu.Button.Pressed.Background}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Background" TargetName="border" Value="{StaticResource Menu.Button.Disabled.Background}"/>
</Trigger>
<Trigger Property="IsFocused" Value="true">
<Setter Property="Background" TargetName="border" Value="{StaticResource Menu.Button.MouseOver.Background}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Code: Select all
public partial class MenuMain : UserControl
{
//Headers---------------------------------------------------------
Viewbox root;
//----------------------------------------------------------------
public MenuMain()
{
InitializeComponent();
}
private void InitializeComponent()
{
Noesis.GUI.LoadComponent(this, "Assets/UI/MainMenu/MenuMain.xaml");
this.root = (Viewbox)FindName("MenuViewBox");
}
protected override bool ConnectEvent(object source, string eventName, string handlerName)
{
if (eventName == "Click" && handlerName == "SPP_FreeSurfButton")
{
((Button)source).Click += this.toFreeSurfPanel;
return true;
}
return false;
}
private void toFreeSurfPanel(object sender, RoutedEventArgs e)
{
//DO CLICK EVENT MAGIC
}
}
I also use the input mapper from the official documentation.
https://www.noesisengine.com/docs/2.2/G ... ml#gamepad
I would like to know if there is a reason behind this, or rather do I have to use certain event names, or certain triggers to get the A button on an Xbox controller calling the same as a mouse click.