Bonjour à tous,

J'ai créé un petit contrôle utilisateur ou j'ai besoin de lui passer un titre (String), une image qui restera fixe et une image qui évoluera (en gros c'est un voyant d'alarme). Pour le moment je n'est que cela, mais éventuellement je repasserais plu-tard des paramètres concernant les graphismes (couleur de fond, couleur de texte ou bordure etc...)

Je charge ce contrôle utilisateur dans des boutons sur ma vue principal ou j'ai besoin d'un traitement lorsque l'utilisateur clique dessus.

Pour le moment mon contrôle utilisateur s'affiche parfaitement dans mes boutons. Mais je n'arrive pas a interagir avec mes propriété du ModeleVue.
Mon contrôle utilisateur à été construit avec la view, le model et la modeleview.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
 
Public Class M_ShapePlant
    Public Property Name As String
    Public Property LBL_Shape As String
    Public Property IMG_Shape As BitmapImage
    Public Property IMG_Alarm As BitmapImage
End Class
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
Public Class VM_ShapePlant
    Inherits VM_Base
    Private Modele As New M_ShapePlant
 
    Public Sub New()
 
    End Sub
 
#Region "Property Language and Visibility"
    Public Property Name As String
        Get
            Return Modele.Name
        End Get
        Set(value As String)
            Modele.Name = value
            OnPropertyChanged("Name")
        End Set
    End Property
    Public Property LBL_Shape As String
        Get
            Return Modele.LBL_Shape
        End Get
        Set(value As String)
            Modele.LBL_Shape = value
            OnPropertyChanged("LBL_Shape")
        End Set
    End Property
    Public Property IMG_Shape As BitmapImage
        Get
            Return Modele.IMG_Shape
        End Get
        Set(value As BitmapImage)
            Modele.IMG_Shape = value
            OnPropertyChanged("IMG_Shape")
        End Set
    End Property
    Public Property IMG_Alarm As BitmapImage
        Get
            Return Modele.IMG_Alarm
        End Get
        Set(value As BitmapImage)
            Modele.IMG_Alarm = value
            OnPropertyChanged("IMG_Alarm")
        End Set
    End Property
    Public Shared ReadOnly LabelProperty As DependencyProperty = DependencyProperty.Register("LBL_Shape", GetType(String), GetType(VM_ShapePlant), New PropertyMetadata(""))
 
#End Region
End Class
J'ai essayé avec les propriétés de dépendance, mais c'est trop flou, si vous avez un tuto pour m'aider. J'ai pas trouvé quelque chose de simple à comprendre. Bien souvent c'est en C# mais bon sa je peux m'en arranger.

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
 
<UserControl x:Class="V_ShapePlant"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:WinCoSMMIC"
             mc:Ignorable="d" Height="65" Width="120">
    <Grid>
 
        <Rectangle Stroke="Black" RadiusX="15" RadiusY="15" StrokeThickness="3" >
            <Rectangle.Fill>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="Black" Offset="0"/>
                    <GradientStop Color="#FFBDB6B6" Offset="1"/>
                </LinearGradientBrush>
            </Rectangle.Fill>
 
        </Rectangle>
 
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="20"/>
                <RowDefinition Height="3"/>
                <RowDefinition Height="40*"/>
                <RowDefinition Height="3"/>
            </Grid.RowDefinitions>
            <Grid Grid.Row="0">
                <StackPanel Height="150" >
                    <Rectangle Stroke="Black" 
                            RadiusX="15" 
                            RadiusY="15" Fill="#FF1B1B1B" Margin="0,0,0,-20" StrokeThickness="3"
                                Height="50">
 
                    </Rectangle>
                </StackPanel>
 
 
                <Label Content="{Binding LBL_Shape,FallbackValue='AC PLANT'}" 
                       HorizontalAlignment="Center" 
                       FontSize="14"
                       HorizontalContentAlignment="Center" 
                       Foreground="#FFFFFF1B" 
                       Margin="10,-4,10,-3" 
                       Width="100"  
                       FontWeight="Bold" />
            </Grid>
            <Rectangle Grid.Row="1" 
                       Fill="Black" 
                       Height="3" 
                       VerticalAlignment="Top" />
            <Grid Grid.Row="2">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <Image Grid.Column="0" 
                       Height="30" 
                       Width="30"
                       Source="{Binding IMG_Shape}"
                       Margin="3,0,0,0"/>
                <Image Grid.Column="1"
                       Height="20"
                       Width="20"
                       Source="{Binding IMG_Alarm}"
                       Margin="0,0,3,0"/>
            </Grid>
        </Grid>
 
    </Grid>
</UserControl>

Merci