IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

C# Discussion :

Bouton dans une WPF DataGrid


Sujet :

C#

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Homme Profil pro
    Conseil - Consultant en systèmes d'information
    Inscrit en
    Décembre 2007
    Messages
    40
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Conseil - Consultant en systèmes d'information

    Informations forums :
    Inscription : Décembre 2007
    Messages : 40
    Par défaut Bouton dans une WPF DataGrid
    Bonjour,
    j'ai un problème assez surprenant dans une datagrid en WPF.

    J'ai lié à une DataGrid une liste d'objet1

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
                dg1.DataContext = List<objet1>
    objet1
    propriété11 Nom
    propriété12 Id
    propriété13 (est-ce que List<objet2> est vide ? true/false)
    propriété14 (est-ce qu'il y a au moins un script dans l'objet2 ? true/false)
    List<objet2>

    objet2
    propriété21 Nom
    propriété22 Id
    propriété23 (est-ce qu'il y a un script ? true/false)
    propriété24 script

    Ma grille contient un Expander pour afficher la List<objet2> dans une seconde grille

    Je gère bien
    - s'il n'y pas d'élément dans List<objet2>, mon Expander affiche un "-" et est dévalidé
    - quand mon Expander est replié, s'il y a dans un des objet2 du code script, une étoile est affichée dans propriété14 (juste pour info)
    - s'il y a des éléments, mon Expander se déroule bien et je peux voir la nouvelle grille

    Dans cette seconde grille, je veux insérer un bouton, qui ouvrira une fenêtre pour afficher le contenu de la propriété22 (il peut y avoir de grand script d'où l'affichage dans une fenêtre).
    Il y a une condition pour afficher le bouton, propriété23 doit être à true

    Tout fonctionne bien, l'Expander affiche bien la grille, le bouton s'affiche bien s'il y a du code.

    Par contre, quand j'insère dans le XAML la gestion de l'événement Click du bouton, ça me donne l'erreur "NullReferenceException" au chargement de la grille.
    C'est la partie Click="Button_Click" qui pose problème, car quand je l'enlève tout fonctionne bien (par contre bien sûr je ne peux pas lancer ma fenêtre pour voir mon code)

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
     
     <DataGrid AutoGenerateColumns="False" 
                Name="dG1" 
                ItemsSource="{Binding List<objet1>}" 
                CanUserAddRows="False" 
                CanUserDeleteRows="False" 
                CanUserResizeColumns="False" 
                CanUserResizeRows="False" 
                RowHeaderWidth="1" 
                ScrollViewer.CanContentScroll="False" 
                IsReadOnly="True">
     
        <DataGrid.Columns>
          <DataGridTextColumn Header="Nom" MinWidth="200" Width="Auto" Binding="{Binding propriété11 }" />
          <DataGridTextColumn Header="ID" HeaderStyle="{StaticResource HeaderRightAlign}" ElementStyle="{StaticResource RightAlignStyle}" Width="40" Binding="{Binding propriété12}" />
     
          <DataGridTemplateColumn Header="Script" Width="Auto">
            <DataGridTemplateColumn.CellTemplate>
              <DataTemplate>
     
                <ItemsControl ItemsSource="{Binding}">
                  <TextBox BorderThickness="0" IsReadOnly="True">
                    <TextBox.Style>
                      <Style TargetType="{x:Type TextBox}">
                        <Style.Triggers>
     
                          <DataTrigger Binding="{Binding Path=propriété14}" Value="true">
                            <Setter Property="Text" Value="*" />
                          </DataTrigger>
     
                        </Style.Triggers>
                      </Style>
                    </TextBox.Style>
     
                  </TextBox>
                </ItemsControl>
     
              </DataTemplate>
            </DataGridTemplateColumn.CellTemplate>
          </DataGridTemplateColumn>
     
          <DataGridTemplateColumn Header="Etapes ..." Width="Auto" MinWidth="400">
     
            <DataGridTemplateColumn.CellTemplate>
              <DataTemplate>
     
                <ItemsControl ItemsSource="{Binding}">
                  <Expander Name="WorkflowExpander">
     
                    <Expander.Style>
                      <Style TargetType="{x:Type Expander}">
                        <Style.Triggers>
     
                          <DataTrigger Binding="{Binding Path=StatesFilled}" Value="true">
                            <Setter Property="IsEnabled" Value="True" />
                          </DataTrigger>
     
                          <DataTrigger Binding="{Binding Path=StatesFilled}" Value="false">
                            <Setter Property="IsEnabled" Value="False" />
                            <Setter Property="Header" Value=" -" />
                          </DataTrigger>
     
                          <Trigger Property= "IsFocused" Value="False">
                            <Setter Property="Background" Value="White" />
                            <Setter Property="BorderBrush" Value="White" />
                          </Trigger>
     
                          <Trigger Property= "IsExpanded" Value="True">
                            <Setter Property="Background" Value="LightGray" />
                            <Setter Property="BorderBrush" Value="White" />
                          </Trigger>
                          <Trigger Property= "IsExpanded" Value="False">
                            <Setter Property="Background" Value="White" />
                            <Setter Property="BorderBrush" Value="White" />
                          </Trigger>
     
                        </Style.Triggers>
                      </Style>
                    </Expander.Style>
     
                    <DataGrid AutoGenerateColumns="False" 
                              Name="dG2" 
                              DataContext="{Binding States}"
                              ItemsSource="{Binding}" 
                              CanUserAddRows="False" 
                              CanUserDeleteRows="False" 
                              CanUserResizeColumns="False" 
                              CanUserResizeRows="False" 
                              RowHeaderWidth="1" 
                              IsReadOnly="True">
     
                      <DataGrid.Columns>
     
                        <DataGridTemplateColumn Header="Nom" Width="Auto" MinWidth="200">
     
                          <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate >
     
                              <ItemsControl ItemsSource="{Binding}">
                                <TextBlock Text="{Binding propriété21}" />
                              </ItemsControl>
     
                            </DataTemplate>
                          </DataGridTemplateColumn.CellTemplate>
     
                        </DataGridTemplateColumn>
     
                        <DataGridTemplateColumn HeaderStyle="{StaticResource HeaderRightAlign}" Header="ID" Width="40">
     
                          <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate >
     
                              <ItemsControl ItemsSource="{Binding}">
                                <TextBlock Style="{StaticResource RightAlignStyle}" Text="{Binding propriété22}" />
                              </ItemsControl>
     
                            </DataTemplate>
                          </DataGridTemplateColumn.CellTemplate>
     
                        </DataGridTemplateColumn>
     
                        <DataGridTemplateColumn Header="VBScript" Width="Auto">
     
                          <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
     
                        <!-- pas d erreur -->
                              <!--<Button Width="30" Height="25" VerticalAlignment="Top">...
                                <Button.Style>
                                  <Style TargetType="{x:Type Button}">
                                    <Setter Property="Visibility" Value="Hidden" />
                                    <Style.Triggers>
                                      <DataTrigger Binding="{Binding Path=propriété23}" Value="true">
                                        <Setter Property="Visibility" Value="Visible" />
                                      </DataTrigger>
                                    </Style.Triggers>
                                  </Style>
                                </Button.Style>
                              </Button>-->
     
                        <!-- erreur  +++ -->
                              <Button Click="Button_Click" Width="30" Height="25" VerticalAlignment="Top">...
                                <Button.Style>
                                  <Style TargetType="{x:Type Button}">
                                    <Setter Property="Visibility" Value="Hidden" />
                                    <Style.Triggers>
                                      <DataTrigger Binding="{Binding Path=propriété23}" Value="true">
                                        <Setter Property="Visibility" Value="Visible" />
                                      </DataTrigger>
                                    </Style.Triggers>
                                  </Style>
                                </Button.Style>
                              </Button>
     
                            </DataTemplate>
                          </DataGridTemplateColumn.CellTemplate>
     
                        </DataGridTemplateColumn>
     
                      </DataGrid.Columns>
     
                    </DataGrid>
     
                  </Expander>
                </ItemsControl>
     
              </DataTemplate>
            </DataGridTemplateColumn.CellTemplate>
     
          </DataGridTemplateColumn>
        </DataGrid.Columns>
     
      </DataGrid>
    Quelqu'un aurait-il déjà vu ce genre d'erreur ?
    Visual Studio Express 2010 ne donne pas beaucoup d'information.

    Cordialement.

    Raphaël

  2. #2
    Membre averti
    Homme Profil pro
    Conseil - Consultant en systèmes d'information
    Inscrit en
    Décembre 2007
    Messages
    40
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Conseil - Consultant en systèmes d'information

    Informations forums :
    Inscription : Décembre 2007
    Messages : 40
    Par défaut
    Je voulais juste préciser une petite chose.

    dans cette application, j'ai déjà utilisé une grille avec des boutons et les mêmes fonctionnalités, et là pas de problème.

    La seule différence, dans la grille il n'y a pas d'Expander qui contient une deuxième liste. Les boutons sont directement dans la grille, alors que pour mon problème, dans la grille il y a l'Expander qui lui même contient une autre grille, dans laquelle il peut y avoir un bouton.

    Ainsi, je n'arrive pas à savoir quel est l'objet qui est nul et qui fait que j'ai ce problème.

    Cordialement.

    Raphaël

  3. #3
    Membre Expert

    Homme Profil pro
    Développeur .NET
    Inscrit en
    Novembre 2010
    Messages
    2 067
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur .NET

    Informations forums :
    Inscription : Novembre 2010
    Messages : 2 067
    Par défaut
    tu as déclaré l'événement Button_Click dans ton code behind ?

  4. #4
    Membre averti
    Homme Profil pro
    Conseil - Consultant en systèmes d'information
    Inscrit en
    Décembre 2007
    Messages
    40
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Conseil - Consultant en systèmes d'information

    Informations forums :
    Inscription : Décembre 2007
    Messages : 40
    Par défaut
    Bonsoir,
    merci youtpout978 pour ta réponse.

    Oui oui, j'ai bien créé la méthode qui est utilisée par le bouton.
    Je l'ai même vidée pour voir si mon problème ne venait du contenu de la méthode...

  5. #5
    Membre Expert

    Homme Profil pro
    Développeur .NET
    Inscrit en
    Novembre 2010
    Messages
    2 067
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur .NET

    Informations forums :
    Inscription : Novembre 2010
    Messages : 2 067
    Par défaut
    un copié collé de l'exception pourrais nous aider à comprendre l'erreur

  6. #6
    Membre averti
    Homme Profil pro
    Conseil - Consultant en systèmes d'information
    Inscrit en
    Décembre 2007
    Messages
    40
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Conseil - Consultant en systèmes d'information

    Informations forums :
    Inscription : Décembre 2007
    Messages : 40
    Par défaut
    Voilà, j'ai copié dans le presse papier le compte rendu de l'erreur.

    L'exception System.NullReferenceException n'a pas été gérée
    Message=La référence d'objet n'est pas définie à une instance d'un objet.
    Source=MonApp
    StackTrace:
    à MonApp.UserControls.WorkflowControl.System.Windows.Markup.IStyleConnector.Connect(Int32 connectionId, Object target) dans d:\Developpements\Projets C#\exe\MonApp\MonApp\UserControls\WorkflowControl.xaml:ligne 147
    à System.Windows.FrameworkTemplate.LoadTemplateXaml(XamlReader templateReader, XamlObjectWriter currentWriter)
    à System.Windows.FrameworkTemplate.LoadTemplateXaml(XamlObjectWriter objectWriter)
    à System.Windows.FrameworkTemplate.LoadOptimizedTemplateContent(DependencyObject container, IComponentConnector componentConnector, IStyleConnector styleConnector, List`1 affectedChildren, UncommonField`1 templatedNonFeChildrenField)
    à System.Windows.FrameworkTemplate.LoadContent(DependencyObject container, List`1 affectedChildren)
    à System.Windows.StyleHelper.ApplyTemplateContent(UncommonField`1 dataField, DependencyObject container, FrameworkElementFactory templateRoot, Int32 lastChildIndex, HybridDictionary childIndexFromChildID, FrameworkTemplate frameworkTemplate)
    à System.Windows.FrameworkTemplate.ApplyTemplateContent(UncommonField`1 templateDataField, FrameworkElement container)
    à System.Windows.FrameworkElement.ApplyTemplate()
    à System.Windows.FrameworkElement.MeasureCore(Size availableSize)
    à System.Windows.UIElement.Measure(Size availableSize)
    à MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
    à System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
    à System.Windows.FrameworkElement.MeasureCore(Size availableSize)
    à System.Windows.UIElement.Measure(Size availableSize)
    à System.Windows.Controls.Border.MeasureOverride(Size constraint)
    à System.Windows.FrameworkElement.MeasureCore(Size availableSize)
    à System.Windows.UIElement.Measure(Size availableSize)
    à System.Windows.Controls.Control.MeasureOverride(Size constraint)
    à System.Windows.Controls.DataGridCell.MeasureOverride(Size constraint)
    à System.Windows.FrameworkElement.MeasureCore(Size availableSize)
    à System.Windows.UIElement.Measure(Size availableSize)
    à System.Windows.Controls.DataGridCellsPanel.MeasureChild(UIElement child, Size constraint)
    à System.Windows.Controls.DataGridCellsPanel.GenerateChild(IItemContainerGenerator generator, Size constraint, DataGridColumn column, Int32& childIndex, Size& childSize)
    à System.Windows.Controls.DataGridCellsPanel.GenerateChildren(IItemContainerGenerator generator, Int32 startIndex, Int32 endIndex, Size constraint)
    à System.Windows.Controls.DataGridCellsPanel.GenerateAndMeasureChildrenForRealizedColumns(Size constraint)
    à System.Windows.Controls.DataGridCellsPanel.MeasureOverride(Size constraint)
    à System.Windows.FrameworkElement.MeasureCore(Size availableSize)
    à System.Windows.UIElement.Measure(Size availableSize)
    à MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
    à System.Windows.Controls.ItemsPresenter.MeasureOverride(Size constraint)
    à System.Windows.FrameworkElement.MeasureCore(Size availableSize)
    à System.Windows.UIElement.Measure(Size availableSize)
    à System.Windows.Controls.Control.MeasureOverride(Size constraint)
    à System.Windows.Controls.Primitives.DataGridCellsPresenter.MeasureOverride(Size availableSize)
    à System.Windows.FrameworkElement.MeasureCore(Size availableSize)
    à System.Windows.UIElement.Measure(Size availableSize)
    à System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
    à System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
    à System.Windows.Controls.Grid.MeasureOverride(Size constraint)
    à System.Windows.FrameworkElement.MeasureCore(Size availableSize)
    à System.Windows.UIElement.Measure(Size availableSize)
    à System.Windows.Controls.Border.MeasureOverride(Size constraint)
    à System.Windows.FrameworkElement.MeasureCore(Size availableSize)
    à System.Windows.UIElement.Measure(Size availableSize)
    à System.Windows.Controls.Control.MeasureOverride(Size constraint)
    à System.Windows.FrameworkElement.MeasureCore(Size availableSize)
    à System.Windows.UIElement.Measure(Size availableSize)
    à System.Windows.Controls.VirtualizingStackPanel.MeasureOverride(Size constraint)
    à System.Windows.Controls.Primitives.DataGridRowsPresenter.MeasureOverride(Size constraint)
    à System.Windows.FrameworkElement.MeasureCore(Size availableSize)
    à System.Windows.UIElement.Measure(Size availableSize)
    à MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
    à System.Windows.Controls.ItemsPresenter.MeasureOverride(Size constraint)
    à System.Windows.FrameworkElement.MeasureCore(Size availableSize)
    à System.Windows.UIElement.Measure(Size availableSize)
    à MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
    à System.Windows.Controls.ScrollContentPresenter.MeasureOverride(Size constraint)
    à System.Windows.FrameworkElement.MeasureCore(Size availableSize)
    à System.Windows.UIElement.Measure(Size availableSize)
    à System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
    à System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
    à System.Windows.Controls.Grid.MeasureOverride(Size constraint)
    à System.Windows.FrameworkElement.MeasureCore(Size availableSize)
    à System.Windows.UIElement.Measure(Size availableSize)
    à System.Windows.Controls.ScrollViewer.MeasureOverride(Size constraint)
    à System.Windows.FrameworkElement.MeasureCore(Size availableSize)
    à System.Windows.UIElement.Measure(Size availableSize)
    à System.Windows.Controls.Border.MeasureOverride(Size constraint)
    à System.Windows.FrameworkElement.MeasureCore(Size availableSize)
    à System.Windows.UIElement.Measure(Size availableSize)
    à System.Windows.Controls.Control.MeasureOverride(Size constraint)
    à System.Windows.Controls.DataGrid.MeasureOverride(Size availableSize)
    à System.Windows.FrameworkElement.MeasureCore(Size availableSize)
    à System.Windows.UIElement.Measure(Size availableSize)
    à MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
    à System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
    à System.Windows.FrameworkElement.MeasureCore(Size availableSize)
    à System.Windows.UIElement.Measure(Size availableSize)
    à System.Windows.Controls.Border.MeasureOverride(Size constraint)
    à System.Windows.FrameworkElement.MeasureCore(Size availableSize)
    à System.Windows.UIElement.Measure(Size availableSize)
    à System.Windows.Controls.Control.MeasureOverride(Size constraint)
    à System.Windows.FrameworkElement.MeasureCore(Size availableSize)
    à System.Windows.UIElement.Measure(Size availableSize)
    à System.Windows.Controls.StackPanel.MeasureOverride(Size constraint)
    à System.Windows.FrameworkElement.MeasureCore(Size availableSize)
    à System.Windows.UIElement.Measure(Size availableSize)
    à System.Windows.ContextLayoutManager.UpdateLayout()
    à System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
    à System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
    à System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
    à System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
    à System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
    à MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
    à System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
    à System.Windows.Threading.DispatcherOperation.InvokeImpl()
    à System.Threading.ExecutionContext.runTryCode(Object userData)
    à System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
    à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
    à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
    à System.Windows.Threading.DispatcherOperation.Invoke()
    à System.Windows.Threading.Dispatcher.ProcessQueue()
    à System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
    à MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
    à MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
    à System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
    à MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
    à System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
    à System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
    à MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
    à MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
    à System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
    à System.Windows.Application.RunInternal(Window window)
    à System.Windows.Application.Run()
    à MonApp.App.Main() dans D:\Developpements\Projets C#\exe\MonApp\MonApp\obj\Debug\App.g.cs:ligne 0
    à System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
    à Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
    à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
    à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
    à System.Threading.ThreadHelper.ThreadStart()
    InnerException:
    La ligne 147 correspond dans mon code à

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    <Button Click="ShowScript" Width="30" Height="25" VerticalAlignment="Top">...
    J'ai bien revérifié, et si j'enlève Click="ShowScript", je n'ai plus d'erreur...

    Raphaël

  7. #7
    Membre averti
    Homme Profil pro
    Conseil - Consultant en systèmes d'information
    Inscrit en
    Décembre 2007
    Messages
    40
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Conseil - Consultant en systèmes d'information

    Informations forums :
    Inscription : Décembre 2007
    Messages : 40
    Par défaut
    Pour info, j'ai mis dans le style de l'objet bouton

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
      <EventSetter Event="Click" Handler="ShowScript" />
    et ça plante pareil.

    Comme tu le dis youtpout978, je pense qu'à cause du niveau supplémentaire dans mes objets, le bouton n'est pas encore créé quand on essaie d'y faire référence, et ça, ça ne m'arrange pas.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Mettre un bouton dans une cellule !!!!
    Par mehdi82 dans le forum Composants
    Réponses: 2
    Dernier message: 22/11/2005, 09h51
  2. choisir le focus du bouton dans une MessageBox?
    Par sher56 dans le forum C++Builder
    Réponses: 2
    Dernier message: 29/10/2005, 00h30
  3. [CSS]problème centrage texte de bouton dans une boîte
    Par Aurelius dans le forum Mise en page CSS
    Réponses: 3
    Dernier message: 06/09/2005, 16h01
  4. Pouvoir gérer les actions des boutons dans une classe
    Par Cyborg289 dans le forum Composants
    Réponses: 2
    Dernier message: 08/07/2005, 12h08
  5. [FLASH 5]un bouton dans une image pour revenir sur une scene
    Par patato valdes dans le forum Flash
    Réponses: 7
    Dernier message: 28/04/2004, 20h21

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo