Bonjour à tous,

J'ai un petit souci en voulant créer une border custom.

Voici le genre de résultat auquel j'aimerais arriver :



Donc, pour se faire, j'ai créé un UserControl avec le code suivant :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
 
<Grid x:Class="SLNolvelisForecastTest.CustomGrid"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    Width="400" Height="300">
    <Grid x:Name="LayoutRoot" Background="White">
        <Border x:Name="Bord" BorderThickness="2" BorderBrush="Black" Margin="15,15,15,15" CornerRadius="3"/>
        <StackPanel x:Name="SP" Margin="30,3,0,0" Background="White" Height="25" Width="100" Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Left">
            <TextBlock x:Name="TB" Margin="8,0,8,0" Text="Title" VerticalAlignment="Center" FontSize="16" FontWeight="Bold"/>
        </StackPanel>
    </Grid>
</Grid>
Tout fonctionne très bien mais j'aimerais ensuite pouvoir l'utiliser de cette manière :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
 
    <Grid x:Name="LayoutRoot">
        <local:CustomGrid>
            <Button/>
        </local:CustomGrid>
    </Grid>
Le problème est que mon contrôle refuse un Content.
J'aurais voulu en quelque sorte Binder le Content de ma CustomGrid sur le contenu de la border qu'il contient.

J'espère avoir été assez clair.

Quelqu'un a-t-il une solution ?

D'avance, je vous remercie.