Bonjour je voudrais savoir si il est possible d'inclure un control dans une resource et m'en servir plus loin?
En rouge le control en resourceEn vert essais d'afficher le control dans grid
VS2008 me dit : Property 'Resources' does not support values of type 'System.Windows.Controls.Button'.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 <Window x:Class="WpfApplication1.TestPascal.ControlDisposition1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:jmb="clr-namespace:JMB.Framework.WPF;assembly=JMB.Framework.WPF" Title="ControlDisposition" Height="300" Width="300" Loaded="Window_Loaded"> <Window.Resources> <Button Name="Test" x:Key="btn">Test</Button> </Window.Resources> <Grid> <Control Resources="{StaticResource btn}"></Control> </Grid> </Window>
Partager