@MartinBeh wrote:
Well... the line that crashes is
form.Show()
Not sure what else I can tell you?
one more test (please tell the moment of the crash):
(
xamlstring = @"
<UserControl
xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'
xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
<Grid Margin='10'>
<TextBlock Text='Hello from WPF'/>
</Grid>
</UserControl>
"
form = dotnetobject "MaxCustomControls.Maxform"
form.Text = "WPF in ElementHost"
elementhost = dotnetobject "System.Windows.Forms.Integration.ElementHost"
form.controls.Add elementhost
form.Showmodeless()
---form.Close()
elementhost.Child = (dotnetclass "System.Windows.Markup.XamlReader").parse xamlstring
)
(
try(form.close()) catch()
form = dotnetobject "MaxCustomControls.Maxform"
form.Text = "WPF in Form"
form.StartPosition = form.StartPosition.Manual
form.Location = dotnetobject "System.Drawing.Point" 200 100
form.Size = dotnetobject "System.Drawing.Size" 400 200
form.BackColor = form.BackColor.Red
panel1 = dotnetobject "Panel"
panel1.Dock = panel1.Dock.Fill
panel1.BackColor = panel1.BackColor.Red
panel2 = dotnetobject "Panel"
panel2.Height = 40
panel2.Dock = panel2.Dock.Top
panel2.BackColor = panel2.BackColor.Yellow
ehost = dotnetobject "Integration.ElementHost"
ehost.Dock = ehost.Dock.Top
ehost.Width = 100
ehost.Height = 20
wpb = dotnetobject "System.Windows.Controls.ProgressBar"
b = dotnetobject "System.Windows.Media.SolidColorBrush" ((dotnetclass "System.Windows.Media.Color").FromRGB 255 0 0)
wpb.Foreground = b
wpb.Width = 100
wpb.Height = 20
wpb.Value = 50
ehost.Child = wpb
panel2.Controls.Add ehost
form.Controls.Add panel2
form.showmodeless()
)
... and this one: