Bonjour
j'ai fait une propriété attachée
j'aimerais l'utiliser dans un expandeur
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 public class ExpanderHelper { public static object GetIcon(DependencyObject obj) { return (object)obj.GetValue(IconProperty); } public static void SetIcon(DependencyObject obj, object value) { obj.SetValue(IconProperty, value); } // Using a DependencyProperty as the backing store for Icon. This enables animation, styling, binding, etc... public static readonly DependencyProperty IconProperty = DependencyProperty.RegisterAttached("Icon", typeof(object), typeof(ExpanderHelper), new PropertyMetadata(null)); }
sous la forme
Code XAML : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 <Expander Style="{DynamicResource ExpanderStyle1}" Header="alpha the century 22" Padding="2" DockPanel.Dock="Top" local:ExpanderHelper.Icon="abcdf" Foreground="White" Background="blue" FontWeight="Bold">
ca fonctionne bien
j'aimerais la faire sous cette forme
Code XAML : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 <Expander Style="{DynamicResource ExpanderStyle1}" Header="alpha the century 22" Padding="2" DockPanel.Dock="Top" Foreground="White" Background="blue" FontWeight="Bold"> <local:ExpanderHelper.Icon>abcdef</local:ExpanderHelper.Icon>
et la ça ne passe plus
je sais pas trop pourquoi alors que si je fais la même chose avec le dockpanel.dock
comme ceci
ça marche bien
Code XAML : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 <Expander Style="{DynamicResource ExpanderStyle1}" Header="alpha the century 22" Padding="2" Foreground="White" Background="blue" FontWeight="Bold"> <DockPanel.Dock>Top</DockPanel.Dock>
vous auriez une solution ?
Partager