WPF Buttons click not working

  • Thread starter Thread starter labjac
  • Start date Start date
L

labjac

Guest
Hallo

We used to WinForms and started our first application in WPF, but for some reason the click events is not working, not sure if it needs to be addressed differently?

<Window x:Class="WCS_WPF_FrontEnd.MainWindow"
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"
xmlns:local="clr-namespace:WCS_WPF_FrontEnd"
mc:Ignorable="d" FontSize="12" FontFamily = "ITC Avant Garde Gothic Demi"
Title="Main Menu" Height="600" Width="1024" Background="#FF1E9BC3" WindowStyle= "ThreeDBorderWindow" WindowState="Maximized" WindowStartupLocation="CenterScreen">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="10"/>
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="10"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="10"/>
<RowDefinition Height=" auto"/>
<RowDefinition Height=" auto"/>
<RowDefinition Height=" auto"/>
<RowDefinition Height=" auto"/>
<RowDefinition Height=" auto"/>
<RowDefinition Height=" *"/>
<RowDefinition Height=" 10"/>
</Grid.RowDefinitions>

<Image Source="images\AdidasLogo.jpg" Grid.Column="1" Grid.Row="1" Width=" 100" Height=" 100" Grid.RowSpan="2" Margin="5,0,5,0" Stretch="Fill"/>
<TextBlock Grid.Column="2" Grid.Row="1" Text="Active Wall" Grid.ColumnSpan="3" FontSize="48" Margin=" 0,5,0,0"
HorizontalAlignment="Center" FontWeight="Bold" FontStyle="Italic" Foreground="#FF03225B"/>

<Button x:Name="WallSetupButton" Grid.Column="1" Grid.Row="3" Height="40" Content="Wall Status" Margin="5" Foreground="White" FontWeight="Bold"
UseLayoutRounding="False" Click="WallSetupButton_Click">
<Button.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FF57788D" Offset="0.276"/>
<GradientStop Color="#FF95B5CA" Offset="0.753"/>
</LinearGradientBrush>
</Button.Background>
</Button>

<Button x:Name="ReportButton" Grid.Column="1" Grid.Row="4" Height="40" Content="Reports" Margin="5" Foreground="White" FontWeight="Bold" UseLayoutRounding="False">
<Button.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FF57788D" Offset="0.276"/>
<GradientStop Color="#FF95B5CA" Offset="0.753"/>
</LinearGradientBrush>
</Button.Background>
</Button>

<Button x:Name="WaveCompleteButton" Grid.Column="1" Grid.Row="5" Height="40" Content="Wave Complete" Margin="5" Foreground="White" FontWeight="Bold" UseLayoutRounding="False">
<Button.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FF57788D" Offset="0.276"/>
<GradientStop Color="#FF95B5CA" Offset="0.753"/>
</LinearGradientBrush>
</Button.Background>
</Button>

<TextBlock x:Name="SettingsLabel" Grid.Column="4" Grid.Row="1" Text="..." HorizontalAlignment="Right" Margin="10" MouseDown="SettingsLabel_MouseDown" />

<Border Grid.Column="1" BorderThickness="1" Grid.Row="3" Grid.RowSpan="3" BorderBrush="LightBlue" >
<Border.Background>
<ImageBrush/>
</Border.Background>
</Border>

<Border Grid.ColumnSpan="2" BorderThickness="1" Grid.Row="1" Grid.RowSpan="1" BorderBrush="LightBlue"
Opacity="80" Grid.Column="3" Margin="10,5,0,0">
<Border.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#7F10638B" Offset="0.801"/>
<GradientStop Color="#05B8CCEA" Offset="0.222"/>
</LinearGradientBrush>
</Border.Background>
<Border.OpacityMask>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="Black" Offset="0"/>
<GradientStop Color="#FF660E0E" Offset="1"/>
</LinearGradientBrush>
</Border.OpacityMask>
</Border>

<DataGrid x:Name="WallGrid" Grid.Column="3" Grid.ColumnSpan="3" Grid.Row="2" Grid.RowSpan="5" Margin="10,10,10,0" />

</Grid>
</Window>





namespace WCS_WPF_FrontEnd
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}

private void SettingsLabel_MouseDown(object sender, MouseButtonEventArgs e)
{
var modelState = new ActiveWallViewModel();
var dt = new DataTable();


dt = modelState.GetActiveWall();
}

private void WallSetupButton_Click(object sender, RoutedEventArgs e)
{
var modelState = new ActiveWallViewModel();
var dt = new DataTable();


dt = modelState.GetActiveWall();
}
}
}

1610513.jpg

1610514.jpg




labjac

Continue reading...
 
Back
Top