tags:

views:

224

answers:

1

I have a WPF UserControl nested inside an ElementHost in a WinForm UserControl intended for use inside an Excel Custom Task Pane (CTP). WinForms isn't displaying a border present on my WPF UserControl. Why is this?

WPF UserControl:

<UserControl x:Class="InventoryCreator.MyWPFControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dg="http://schemas.microsoft.com/wpf/2008/toolkit"
Height="547" Width="200"
SnapsToDevicePixels="True">
<Grid>
    <Button Height="38.75" Margin="12,12,13.75,0" Name="btnCreateNew" VerticalAlignment="Top" Click="button1_Click">Create New Template</Button>
    <!-- BorderBrush not showing up inside the winform UserControl 
    but is there because the background does change -->
    <Border BorderBrush="Azure" Background="AliceBlue" Margin="1,57,1,1">
        <Grid Width="178" Height="454">
            <dg:DataGrid Margin="3,31,7,63" />
            <Label Height="28" Margin="39,6,17,0" Name="availableLabel" VerticalAlignment="Top">Available Templates</Label>
        </Grid>
    </Border>
</Grid>

I'm using this WinForm control inside as a CTP in excel but I don't know what that might have to do with it since it's showing up wrong in the WinForm Designer, as well.

A: 

Ahh now that I see the code I can see the problem is because you don't have a BorderThickness attribute on the Border element. Add BorderThickness="1".

Josh Einstein
It was showing up in the WPF designer. Tricksy. Thanks.
Daniel Harvey