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 :

Afficher dans un textbox la propriete d'un objet en le selectionnant dans une listbox


Sujet :

C#

  1. #1
    Membre à l'essai
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Mars 2014
    Messages
    32
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : France, Seine et Marne (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Aéronautique - Marine - Espace - Armement

    Informations forums :
    Inscription : Mars 2014
    Messages : 32
    Points : 23
    Points
    23
    Par défaut Afficher dans un textbox la propriete d'un objet en le selectionnant dans une listbox
    Bonjour a tous,

    Je m’explique, j'ai un canvas dans lequel je créer des points, une listBox qui affiche le point des qu'il est créer (j'affiche un certain paramètres dans la liste box pour les identifier)

    Mais ce que j'aimerais également est lorsque que je sélectionne un des points dans la listbox, tout les paramètres de cet objet soit affichés dans des textbox différentes (une pour le X, une pour le Y etc ... )

    Apres le truc est que je fait l'affichage dans la listbox en "simulant" du binding et le mieux serait que le listbox bind directement ma collection de point et les texbox les propriétés du point sélectionné ..

    Je vous transmet mon code pour que ce soit un peu plus clair .. j'ai fait quelques essais mais peu concluant :/

    Le code XAML

    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
    <Window x:Class="WpfApplication1.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Title="MainWindow" Height="432" Width="646">
        <Grid DataContext="{Binding}">
     
            <ItemsControl x:Name="ItemPointSimple" ItemsSource="{Binding CollecNoeuds}" PreviewMouseLeftButtonUp="ItemPointSimple_PreviewMouseLeftButtonUp" PreviewMouseLeftButtonDown="ItemPointSimple_PreviewMouseLeftButtonDown" PreviewMouseMove="ItemPointSimple_PreviewMouseMove" PreviewMouseDoubleClick="ItemPointSimple_PreviewMouseDoubleClick" Margin="12,24,283,12" BorderBrush="#FFE84747" Background="#FFE8C16E" DataContext="{Binding}" Opacity="1">
     
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <Canvas x:Name="cnvTimeZones" Background="Transparent"/>
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
     
                <ItemsControl.ItemContainerStyle>
                    <Style>
                        <Setter Property="Canvas.Left" Value="{Binding Path=Coord_P.X, Mode=TwoWay}"/>
                        <Setter Property="Canvas.Top" Value="{Binding Path=Coord_P.Y, Mode=TwoWay}"/>
                    </Style>
                </ItemsControl.ItemContainerStyle>
     
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <Ellipse Width="{Binding Width}" Height="{Binding Height}" Fill="{Binding ColorPoint}" Stroke="{Binding ColorContour}" >
                        </Ellipse>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
     
            </ItemsControl>
     
            <ListBox ItemsSource="{Binding CollecNoeuds}" Height="100" HorizontalAlignment="Left" Margin="492,24,0,0" Name="listBox1" VerticalAlignment="Top" Width="120" Background="#FF6EA3E2" SelectedValuePath="CollecNoeuds.No_ID_Noeud" Loaded="listBox1_Loaded" >
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="{Binding No_ID_Noeud}" />
                        </StackPanel>
                    </DataTemplate>
                </ListBox.ItemTemplate>
                <ListBox.ItemContainerStyle>
                    <Style TargetType="ListBoxItem">
                        <Setter Property="IsSelected" Value="{Binding IsSelected}" />
                    </Style>
                </ListBox.ItemContainerStyle>
            </ListBox>
     
            <TextBox Height="23" HorizontalAlignment="Left" Margin="492,130,0,0" Name="tb_Coord_P_Noeud" VerticalAlignment="Top" Width="120">
                <TextBox.Text>
                    <Binding Source="CollecNoeuds" Path="Coord_P" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged"/>
                </TextBox.Text>
            </TextBox>
            <TextBox Height="23" HorizontalAlignment="Left" Margin="492,159,0,0" Name="tb_Coord_Z_Noeud" VerticalAlignment="Top" Width="120" >
                <TextBox.Text>
                    <Binding Source="CollecNoeuds" Path="Coord_Z" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged"/>
                </TextBox.Text>
            </TextBox>
            <TextBox Height="23" HorizontalAlignment="Left" Margin="492,188,0,0" Name="tb_ID_Noeud" VerticalAlignment="Top" Width="120" >
                <TextBox.Text>
                    <Binding Source="CollecNoeuds" Path="No_ID_Noeud" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged"/>
                </TextBox.Text>
            </TextBox>
            <TextBox Height="23" HorizontalAlignment="Left" Margin="492,217,0,0" Name="tb_Etage_Noeud" VerticalAlignment="Top" Width="120" >
                <TextBox.Text>
                    <Binding Source="CollecNoeuds" Path="No_Etage" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged"/>
                </TextBox.Text>
            </TextBox>
            <TextBox Height="23" HorizontalAlignment="Left" Margin="492,246,0,0" Name="tb_Type_Noeud" VerticalAlignment="Top" Width="120" >
                <TextBox.Text>
                    <Binding Source="CollecNoeuds" Path="TypeNoeud" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged"/>
                </TextBox.Text>
            </TextBox>
            <ListBox Height="100" HorizontalAlignment="Left" Margin="355,24,0,0" Name="listBox2" VerticalAlignment="Top" Width="120" Background="#FFC3D11E" SelectionChanged="listBox2_SelectionChanged" MouseDoubleClick="listBox2_MouseDoubleClick" />
            <ListBox Height="100" HorizontalAlignment="Left" Margin="355,140,0,0" Name="listBox3" VerticalAlignment="Top" Width="120" BorderBrush="#FF3434B1" />
            <Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="373,246,0,0" Name="button1" VerticalAlignment="Top" Width="75" Click="button1_Click" />
            <Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="532,296,0,0" Name="button2" VerticalAlignment="Top" Width="75" Click="button2_Click" />
        </Grid>
    </Window>
    Le code Behind

    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
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;
    using System.Windows.Navigation;
    using System.Windows.Shapes;
    using System.ComponentModel;
    using System.Data;
    using System.IO;
    using System.Reflection;
     
    using System.Collections.ObjectModel;
     
    using WpfApplication1.Models;
     
     
    namespace WpfApplication1
    {
        /// <summary>
        /// Logique d'interaction pour MainWindow.xaml
        /// </summary>
        public partial class MainWindow : Window
        {
     
           // public ObservableCollection<EventItems> RectItemsSimple { get; set; }
            public ObservableCollection<ClassArcs> CollecArcs { get; set; }
            public ObservableCollection<ClassNoeuds> CollecNoeuds { get; set; }
     
            private ClassNoeuds _draggedObjectFind = null;
            private System.Windows.Shapes.Path selectedPath = null;
            bool IsDrag = false;
     
     
     
     
     
            public MainWindow()
            {
                InitializeComponent();
     
                //RectItemsSimple = new ObservableCollection<EventItems>();
                CollecArcs = new ObservableCollection<ClassArcs>();
                CollecNoeuds = new ObservableCollection<ClassNoeuds>();
     
     
                //RectItemsSimple.Add(new EventItems { X = 10, Y = 10, ColorPoint = Brushes.Black, Height = 5, Width = 5 });
                //RectItemsSimple.Add(new EventItems { X = 20, Y = 10, ColorPoint = Brushes.Red, Height = 5, Width = 5 });
                //RectItemsSimple.Add(new EventItems { X = 10, Y = 40, ColorPoint = Brushes.Green, Height = 5, Width = 5 });
                //RectItemsSimple.Add(new EventItems { X = 50, Y = 40, ColorPoint = Brushes.Yellow, Height = 15, Width = 15 });
     
                ItemPointSimple.ItemsSource = CollecNoeuds;
                ItemPointSimple.DataContext = CollecNoeuds;
                //ItemArcSimple.ItemsSource = CollecArcs;
                //ItemArcSimple.DataContext = CollecArcs;
     
                //ItemPointSimple.ItemsSource = RectItemsSimple;
                //ItemPointSimple.DataContext = RectItemsSimple;
            }
     
            private void ItemPointSimple_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
            {
                IsDrag = false;
            }
     
            private void ItemPointSimple_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
            {
                ItemsControl _sourceItemsControl = new ItemsControl();
                object _draggedObject;
     
                if (sender is ItemsControl)
                    _sourceItemsControl = (ItemsControl)(sender);
                else
                    return;
     
                FrameworkElement sourceItemsContainer = _sourceItemsControl.ContainerFromElement((Visual)e.OriginalSource) as FrameworkElement;
     
                if (sourceItemsContainer == null)
                    _draggedObject = _sourceItemsControl.DataContext;
                else if (sourceItemsContainer == e.Source)
                    _draggedObject = e.Source;
                else
                    _draggedObject = sourceItemsContainer.DataContext;
     
                if (_draggedObject is ClassNoeuds)
                {
                    _draggedObjectFind = _draggedObject as ClassNoeuds;
                }
                else
                {
                    _draggedObjectFind = null;
                }
     
                IsDrag = true;
            }
     
            private void ItemPointSimple_PreviewMouseMove(object sender, MouseEventArgs e)
            {
                Point MouseMovePositionRecord = Mouse.GetPosition(ItemPointSimple);
     
                if (IsDrag & _draggedObjectFind != null)
                {
                    _draggedObjectFind.Coord_P = (MouseMovePositionRecord);
                }
            }
     
            private void ItemPointSimple_PreviewMouseDoubleClick(object sender, MouseEventArgs e)
            {
                int etage = 0;
                int c = CollecNoeuds.Count;
                int ID = c + 1;
                Point MouseMovePositionRecord = Mouse.GetPosition(ItemPointSimple);
                double z = 0;
                int type = 0;
     
                AjoutNoeudsCollec(MouseMovePositionRecord, z, etage, ID, type);
     
                //CollecNoeuds.Add(new ClassNoeuds { etage, ID, MouseMovePositionRecord, z, type });
            }
     
            public void AjoutArcsCollec(ClassNoeuds _node_D, ClassNoeuds _node_F, int _no_ID_Arc, int _TypeArc)
            {
                //Création de l'arc avec les parametres en entrée 
                ClassArcs MyArcs = new ClassArcs();
                MyArcs.Node_D = _node_D;
                MyArcs.Node_F = _node_F;
                MyArcs.No_ID_Arc = _no_ID_Arc;
                MyArcs.TypeArc = _TypeArc;
                MyArcs.ColorLigne = Brushes.Blue;
     
                //Ajout des noeuds de l'arc à la collection de noeuds via la fonction d'ajout 
                AjoutNoeudsCollec(_node_D.Coord_P, _node_D.Coord_Z, _node_D.No_Etage, _node_D.No_ID_Noeud, _node_D.TypeNoeud);
                AjoutNoeudsCollec(_node_F.Coord_P, _node_F.Coord_Z, _node_F.No_Etage, _node_F.No_ID_Noeud, _node_F.TypeNoeud);
     
                //Comptage du nombre d'objets dans la collection
                int c = CollecArcs.Count();
     
                //Ajout de l'arc à la collection d'arc
                CollecArcs.Insert(c, MyArcs);
            }
     
            public void SupprimeArcsCollec(ClassArcs _Arcs)
            {
                //Récupération de l'index de l'arc choisi 
                int MyIndex = CollecArcs.IndexOf(_Arcs);
     
                //Suppression de l'arc à l'index choisi
                CollecArcs.RemoveAt(MyIndex);
     
                //Comptage du nombre d'éléments de la collection
                int c = CollecArcs.Count();
            }
     
            public void AjoutNoeudsCollec(Point _Coord_P, double _Coord_Z, int _no_Etage, int _no_ID_Noeuds, int _TypeNoeud)
            {
                //Création du nouveau noeud avec les parametres d'entrée
                ClassNoeuds MyNoeuds = new ClassNoeuds();
                MyNoeuds.Coord_P = _Coord_P;
                MyNoeuds.Coord_Z = _Coord_Z;
                MyNoeuds.No_Etage = _no_Etage;
                MyNoeuds.No_ID_Noeud = _no_ID_Noeuds;
                MyNoeuds.TypeNoeud = _TypeNoeud;
                MyNoeuds.ColorPoint = Brushes.Red;
                MyNoeuds.ColorContour = Brushes.Black;
                MyNoeuds.Height = 10;
                MyNoeuds.Width = 10;
     
                //Comptage du nombre d'éléments de la collection
                int c = CollecNoeuds.Count();
     
                //Ajout du noeud à l'index égal au total d'objets de la collection
                CollecNoeuds.Insert(c, MyNoeuds);
     
                //Ajout a la listBox des noeuds 
                listBox2.Items.Add("Noeud : " + MyNoeuds.No_ID_Noeud);
            }
     
            public void SupprimeNoeudsCollec(ClassNoeuds _Noeuds)
            {
                //Récupération de l'index du noeud choisi 
                int MyIndex = CollecNoeuds.IndexOf(_Noeuds);
     
                //Suppression du noeud à l'index choisi
                CollecNoeuds.RemoveAt(MyIndex);
     
                //Parcours de la collection d'arcs et suppression des arcs ayant en point_D ou Point_F le Noeuds d'entrée 
                foreach (ClassArcs ClassArcs in CollecArcs)
                {
                    if (ClassArcs.Node_D == _Noeuds)
                    {
                        SupprimeArcsCollec(ClassArcs);
                    }
                    else if (ClassArcs.Node_F == _Noeuds)
                    {
                        SupprimeArcsCollec(ClassArcs);
                    }
                    else { }
                }
     
                //Compte du nombre d'objets dans la collection 
                int c = CollecNoeuds.Count();
     
                //listBox2.Items.RemoveAt(
            }
     
            public void AjoutPointSurArc(ObservableCollection<ClassArcs> _Arcs, ClassNoeuds _OldArc_PointD, ClassNoeuds _OldArc_PointF, int _no_ID_Arc, ClassNoeuds _NewPoint)
            {
                //Le principe est de supprimer l'ancien arc et d'en créer deux nouveaux.
                //Le premier (arc A) possède comme PointD celui de l'ancien arc et comme PointF le NewPoint,
                //Le seconde (arc B) possède comme PointD le NewPoint et comme PointF celui de l'ancien arc.
                //            PD          PF        PD  newPF-newPD   PF
                //             X----------X   -->   X--------X--------X
                //             ARC Origine             ARC A    ARC B 
                //En vrai on créer les deux nouveaux arcs avant de supprimer l'arc d'origine,
                //Sinon les PointD et PointF dont on aura besoin auront disparus
     
                /*
                //Creation arc de depart
                Point PointD = new Point(10, 10);
                Point PointF = new Point(20, 10);
                ClassNoeuds OldArc_PointD = new ClassNoeuds(1, 1, PointD, 1);
                ClassNoeuds OldArc_PointF = new ClassNoeuds(1, 2, PointF, 1);
                ClassArcs OldArc = new ClassArcs(OldArc_PointD, OldArc_PointF, 10);
                
                //Ajout d'un Point
                Point NewPoint = new Point(15, 10);
                */
                //Récupération des données des noeuds de l'arc de départ
                ClassNoeuds OldArc_PointD = _OldArc_PointD;
                ClassNoeuds OldArc_PointF = _OldArc_PointF;
                int ID_OldArc = _no_ID_Arc;
     
                //Et de celles du nouveau point 
                ClassNoeuds NewPoint = _NewPoint;
     
                //Création des noeuds des 2 nouveaux arcs
                ClassNoeuds NewArc_A_PointD = new ClassNoeuds(1, 1, OldArc_PointD.Coord_P, 1, 1);
                ClassNoeuds NewArc_A_PointF = new ClassNoeuds(1, 2, NewPoint.Coord_P, 1, 1);
     
                ClassNoeuds NewArc_B_PointD = new ClassNoeuds(1, 2, NewPoint.Coord_P, 1, 1);
                ClassNoeuds NewArc_B_PointF = new ClassNoeuds(1, 3, OldArc_PointF.Coord_P, 1, 1);
     
                //Creation des deux arcs qui remplaceront l'arc de départ 
                ClassArcs NewArc_A = new ClassArcs(NewArc_A_PointD, NewArc_A_PointF, 11, 1);
                ClassArcs NewArc_B = new ClassArcs(NewArc_B_PointD, NewArc_B_PointF, 12, 1);
     
                //Suppression de l'ancien arc
                //SupprimeArcsCollec(OldArc);
     
                //Ajout des deux nouveaux arcs
                AjoutArcsCollec(NewArc_A_PointD, NewArc_A_PointF, 11, 1);
                AjoutArcsCollec(NewArc_B_PointD, NewArc_B_PointF, 12, 1);
            }
     
            private void listBox1_Loaded(object sender, RoutedEventArgs e)
            {
                //listBox1.ItemsSource.Equals(CollecNoeuds);
     
                foreach (ClassNoeuds MyNoeuds in CollecNoeuds) 
                {
                    listBox1.Items.Add(MyNoeuds.No_ID_Noeud); 
                }
            }
     
     
            private void listBox2_MouseDoubleClick(object sender, MouseButtonEventArgs e)
            {
                //listBox2.Items[listBox2.SelectedIndex] = tb_Coord_P_Noeud.Text; 
                //this.listBox1.DoubleClick += new System.EventHandler(this.listBox1_DoubleClick);
                object item = listBox2.SelectedItem;
                ClassNoeuds Item = (ClassNoeuds)sender;
                int index = listBox2.SelectedIndex;
                if (index > -1 && index <= CollecNoeuds.Count)
                {
                    tb_Coord_P_Noeud.Text.Equals(askObject(sender, "Coord_P"));
                    //tb_Coord_P_Noeud.SetBinding(TextBox.TextProperty, new Binding("Coord_P"));
                    //tb_Coord_P_Noeud.Text.Equals(listBox2.SelectedItem.ToString());
                    tb_Coord_P_Noeud.Text.Equals(Item.Coord_P.ToString());
                    tb_Coord_P_Noeud.Text.Equals(askObject(Item, "Coord_P").ToString());
                    tb_Coord_Z_Noeud.Text.Equals(CollecNoeuds[index].Coord_Z.ToString());
                    tb_ID_Noeud.Text.Equals(CollecNoeuds[index].No_ID_Noeud.ToString());
                    tb_Etage_Noeud.Text.Equals(CollecNoeuds[index].No_Etage.ToString());
                    tb_Type_Noeud.Text.Equals(CollecNoeuds[index].TypeNoeud.ToString());
                }
     
     
            }
     
            private string askObject(object o, string prop)
            {
                PropertyInfo property = typeof(ClassNoeuds).GetProperty(prop);
                object value = property.GetValue(o, null);
                string value_S = value.ToString();
                return value_S;
            }
     
            private void RemplirList()
            {
                listBox3.Items.Clear(); 
                foreach (ClassNoeuds MyNoeuds in CollecNoeuds)
                {
                    ListBoxItem item = new ListBoxItem();
                    item.Tag = MyNoeuds;
                    item.Content = MyNoeuds.Coord_P;//.InnerText
                    listBox3.Items.Add(item);
                }
            }
     
            private void RemplirTextBox()
            {
     
            }
            private void button1_Click(object sender, RoutedEventArgs e)
            {
                RemplirList();
            }
     
            private void listBox2_SelectionChanged(object sender, SelectionChangedEventArgs e)
            {
     
            }
     
            private void button2_Click(object sender, RoutedEventArgs e)
            {
     
            }
     
     
     
        }
    }
    le code des classes utilisées

    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
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;
    using System.Windows.Navigation;
    using System.Windows.Shapes;
    using System.ComponentModel;
    using System.Data;
    using System.IO;
     
    namespace WpfApplication1.Models
    {
     
     
        public class Etages : INotifyPropertyChanged
        {
            private int propNo_Etage;
            public int No_Etage
            {
                get { return (this.propNo_Etage); }
                set { this.propNo_Etage = value; RaisePropertyChanged("No_Etage"); }
            }
     
            private double propZ_Etage;
            public double Z_Etage
            {
                get { return (this.propZ_Etage); }
                set { this.propZ_Etage = value; RaisePropertyChanged("Z_Etage"); }
            }
     
            //Evenement  de changement de propriétés 
            public event PropertyChangedEventHandler PropertyChanged;
            private void RaisePropertyChanged(string propName)
            {
                PropertyChangedEventHandler h = PropertyChanged;
                if (h != null)
                    h(this, new PropertyChangedEventArgs(propName));
            }
     
            //Constructeur
            public Etages()
            {
                No_Etage = 0;
                Z_Etage = 0;
            }
     
            //Constructeur Surchargé 
            public Etages(int ONo_Etage, double OZ_Etage)
                : this()
            {
                No_Etage = ONo_Etage;
                Z_Etage = OZ_Etage;
            }
        }
     
        public class ClassNoeuds : INotifyPropertyChanged
        {
            //Constructeur
            public ClassNoeuds()
            {
                No_Etage = 0;
                Coord_P = new Point(0, 0);
                No_ID_Noeud = 00;
                Coord_Z = 0;
                TypeNoeud = 0;
            }
     
            //Constructeur Surchargé
            public ClassNoeuds(int ONo_Etage, int OID_Noeud, Point OCoordPoint, double OCoord_Z, int OTypeNoeud)
                : this()
            {
                No_Etage = ONo_Etage;
                Coord_P = OCoordPoint;
                No_ID_Noeud = OID_Noeud;
                Coord_Z = OCoord_Z;
                TypeNoeud = OTypeNoeud;
            }
     
            //Declaration des differents parametres de la classe Noeuds
            private int propNo_ID_Noeud;
            public int No_ID_Noeud
            {
                get { return (this.propNo_ID_Noeud); }
                set { this.propNo_ID_Noeud = value; NotifyPropertyChanged("No_ID_Noeud"); }
            }
     
            private int propNo_Etage;
            public int No_Etage
            {
                get { return (this.propNo_Etage); }
                set { this.propNo_Etage = value; NotifyPropertyChanged("No_Etage"); }
            }
     
            private Point propCoord_P;
            public Point Coord_P
            {
                get { return propCoord_P; }
                set { propCoord_P = value; NotifyPropertyChanged("Coord_P"); }
            }
     
            private double propCoord_Z;
            public double Coord_Z
            {
                get { return (this.propCoord_Z); }
                set { this.propCoord_Z = value; NotifyPropertyChanged("Coord_Z"); }
            }
     
            private int propTypeNoeud;
            public int TypeNoeud
            {
                get { return (this.propTypeNoeud); }
                set { this.propTypeNoeud = value; NotifyPropertyChanged("TypeNoeud"); }
            }
     
            public double Width { get; set; }
            public double Height { get; set; }
            public SolidColorBrush ColorPoint { get; set; }
            public SolidColorBrush ColorContour { get; set; }
     
            //Evenement  de changement de propriétés 
            public event PropertyChangedEventHandler PropertyChanged;
            private void NotifyPropertyChanged(String propName)
            {
                PropertyChangedEventHandler h = PropertyChanged;
                if (h != null)
                    h(this, new PropertyChangedEventArgs(propName));
            }
     
            public void Change_Z(double New_Z)
            {
                this.Coord_Z = New_Z;
            }
        }
     
        public class ClassArcs : INotifyPropertyChanged
        {
            //Constructeur
            public ClassArcs()
            {
                Node_D = new ClassNoeuds();
                Node_F = new ClassNoeuds();
                No_ID_Arc = 0;
                TypeArc = 0;
            }
     
            //Constructeur Surchargé 
            public ClassArcs(ClassNoeuds ONode_D, ClassNoeuds ONode_F, int ONo_ID_Arc, int OTypeArc)
                : this()
            {
                Node_D = ONode_D;
                Node_F = ONode_F;
                No_ID_Arc = ONo_ID_Arc;
                TypeArc = OTypeArc;
            }
     
            //Declaration des differents parametres de la classe Arcs
            private ClassNoeuds node_D;
            public ClassNoeuds Node_D
            {
                get { return node_D; }
                set { node_D = value; NotifyPropertyChanged("Node_D"); }
            }
     
            private ClassNoeuds node_F;
            public ClassNoeuds Node_F
            {
                get { return node_F; }
                set { node_F = value; NotifyPropertyChanged("Node_F"); }
            }
     
            private int propNo_ID_Arc;
            public int No_ID_Arc
            {
                get { return (this.propNo_ID_Arc); }
                set { this.propNo_ID_Arc = value; NotifyPropertyChanged("No_ID_Arc"); }
            }
     
            private int propTypeArc;
            public int TypeArc
            {
                get { return (this.propTypeArc); }
                set { this.propTypeArc = value; NotifyPropertyChanged("TypeArc"); }
            }
     
            public SolidColorBrush ColorLigne { get; set; }
     
            //Evenement de changement de propriétés 
            public event PropertyChangedEventHandler PropertyChanged;
            private void NotifyPropertyChanged(String propName)
            {
                PropertyChangedEventHandler h = PropertyChanged;
                if (h != null)
                    h(this, new PropertyChangedEventArgs(propName));
            }
     
        }
     
    }
    Voila en espérant trouver un peu d'aide ..

  2. #2
    Membre à l'essai
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Mars 2014
    Messages
    32
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : France, Seine et Marne (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Aéronautique - Marine - Espace - Armement

    Informations forums :
    Inscription : Mars 2014
    Messages : 32
    Points : 23
    Points
    23
    Par défaut
    Personne .. ?

Discussions similaires

  1. Réponses: 0
    Dernier message: 30/01/2011, 21h35
  2. (VS2003) Curseur ne s'affiche pas dans un textBox
    Par fakhirov dans le forum Windows Forms
    Réponses: 1
    Dernier message: 08/08/2007, 10h41
  3. Réponses: 3
    Dernier message: 19/02/2007, 23h35
  4. [MySQL] afficher des données dans un textbox
    Par josémaria dans le forum PHP & Base de données
    Réponses: 4
    Dernier message: 09/11/2006, 16h52
  5. Réponses: 11
    Dernier message: 20/06/2006, 11h10

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