Click here to Skip to main content
15,897,187 members
Home / Discussions / WPF
   

WPF

 
QuestionI want to see best practise c# project in wpf with db Pin
TGiril7-Aug-09 6:25
TGiril7-Aug-09 6:25 
AnswerRe: I want to see best practise c# project in wpf with db Pin
Super Lloyd7-Aug-09 15:01
Super Lloyd7-Aug-09 15:01 
QuestionMouseUp-Event doesn't react on left mouse button Pin
MyPiano7-Aug-09 5:40
MyPiano7-Aug-09 5:40 
AnswerRe: MouseUp-Event doesn't react on left mouse button Pin
Mark Salsbery7-Aug-09 7:42
Mark Salsbery7-Aug-09 7:42 
GeneralRe: MouseUp-Event doesn't react on left mouse button Pin
MyPiano7-Aug-09 7:58
MyPiano7-Aug-09 7:58 
GeneralRe: MouseUp-Event doesn't react on left mouse button Pin
Mark Salsbery7-Aug-09 8:43
Mark Salsbery7-Aug-09 8:43 
GeneralRe: MouseUp-Event doesn't react on left mouse button [modified] Pin
MyPiano7-Aug-09 10:22
MyPiano7-Aug-09 10:22 
GeneralRe: MouseUp-Event doesn't react on left mouse button Pin
Mark Salsbery7-Aug-09 11:41
Mark Salsbery7-Aug-09 11:41 
MyPiano wrote:
Could the reason why the left mouse button doesn't work be that I don't ask whether the mouse-down event war fired?


I haven't seen any of your code so I could only guess. How do
you know it's not working? To test the code I posted, I just
put a breakpoint in the event handler method and ran the app in the
debugger.

MyPiano wrote:
I don't know where I have to put the <Style x:Key=""...


That is explained here: Resources Overview[^]

Here's a more complete example:
<Window x:Class="WPFTester.MyWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:WPFTester"
    Title="MyWindow" WindowStartupLocation="CenterScreen" 
    Width="300" Height="300">

    <Window.Resources>
        <Style x:Key="LabelButtonStyle" TargetType="Button">
            <Setter Property="OverridesDefaultStyle" Value="True"/>
            <Setter Property="Cursor" Value="Hand"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Grid HorizontalAlignment="Center" VerticalAlignment="Center">
                            <Label Content="{TemplateBinding Content}" />
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Window.Resources>
    
    <Grid>
        <StackPanel>
            <Button Name="labelButton" Style="{StaticResource LabelButtonStyle}" Content="Label Button" Click="labelButton_Click" /> 
            <Button HorizontalAlignment="Center" VerticalAlignment="Center" >
                <Image Source="Images/Silverlight_Logo.jpg" Stretch="None" /> 
            </Button>
            <Image Name="theImage" Source="Images/Silverlight_Logo.jpg" Stretch="None" MouseLeftButtonDown="theImage_MouseLeftButtonDown" MouseLeftButtonUp="theImage_MouseLeftButtonUp"  />
        </StackPanel>
    </Grid>
	
</Window>

using System;
using System.Windows;
using System.Windows.Controls;

namespace WPFTester
{
    /// <summary>
    /// Interaction logic for MyWindow.xaml
    /// </summary>
    public partial class MyWindow : Window
    {
        public MyWindow()
        {
            InitializeComponent();
        }
		
        private void labelButton_Click(object sender, RoutedEventArgs e)
        {
        } <code>//<-- put breakpoint here</code>

        private void theImage_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
        } <code>//<-- put breakpoint here</code>

        private void theImage_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
        } <code>//<-- put breakpoint here</code>
    }
}


Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

GeneralRe: MouseUp-Event doesn't react on left mouse button Pin
MyPiano7-Aug-09 12:14
MyPiano7-Aug-09 12:14 
GeneralRe: MouseUp-Event doesn't react on left mouse button Pin
Mark Salsbery7-Aug-09 13:13
Mark Salsbery7-Aug-09 13:13 
GeneralRe: MouseUp-Event doesn't react on left mouse button Pin
MyPiano8-Aug-09 8:02
MyPiano8-Aug-09 8:02 
QuestionDatabinding in Silverlight with databases other than with SQL Server Pin
pisanis7-Aug-09 4:53
pisanis7-Aug-09 4:53 
AnswerRe: Databinding in Silverlight with databases other than with SQL Server [modified] Pin
Mike Marynowski7-Aug-09 6:30
professionalMike Marynowski7-Aug-09 6:30 
AnswerRe: Databinding in Silverlight with databases other than with SQL Server [modified] Pin
Mark Salsbery7-Aug-09 7:23
Mark Salsbery7-Aug-09 7:23 
AnswerRe: Databinding in Silverlight with databases other than with SQL Server Pin
Michael Sync8-Aug-09 6:08
Michael Sync8-Aug-09 6:08 
GeneralDynamically loading Silverlight UserControl from a single.xap [modified] Pin
Amit Rai Sharma6-Aug-09 23:37
Amit Rai Sharma6-Aug-09 23:37 
QuestionNeed just idea or suggestion can u help me? Pin
wasimsharp6-Aug-09 23:12
wasimsharp6-Aug-09 23:12 
AnswerRe: Need just idea or suggestion can u help me? Pin
#realJSOP7-Aug-09 0:54
professional#realJSOP7-Aug-09 0:54 
QuestionNeed an advice about starting a raster drawing program with WPF Pin
Cristoff6-Aug-09 22:54
Cristoff6-Aug-09 22:54 
AnswerRe: Need an advice about starting a raster drawing program with WPF Pin
#realJSOP7-Aug-09 0:57
professional#realJSOP7-Aug-09 0:57 
GeneralRe: Need an advice about starting a raster drawing program with WPF Pin
Cristoff7-Aug-09 2:23
Cristoff7-Aug-09 2:23 
GeneralRe: Need an advice about starting a raster drawing program with WPF PinPopular
#realJSOP7-Aug-09 3:43
professional#realJSOP7-Aug-09 3:43 
GeneralRe: Need an advice about starting a raster drawing program with WPF Pin
Cristoff7-Aug-09 3:53
Cristoff7-Aug-09 3:53 
GeneralRe: Need an advice about starting a raster drawing program with WPF Pin
Pete O'Hanlon7-Aug-09 3:56
mvePete O'Hanlon7-Aug-09 3:56 
GeneralRe: Need an advice about starting a raster drawing program with WPF Pin
Cristoff7-Aug-09 4:58
Cristoff7-Aug-09 4:58 

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.