Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Edit Content in Winform ElementHost

$
0
0

Hi all

I hope someone can help me to understand ..<o:p></o:p>

In my example i have a winform + elementhost <o:p></o:p>

If i try to add some object into elementhost it doesn't work and nothing happens<o:p></o:p>

However if i add some ojerct into elementhost in sub New() it work perfectly and i can see in my winform.<o:p></o:p>

Why? 

<o:p>This is an example:</o:p>

XAML

<UserControl x:Class="UserControl1"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             mc:Ignorable="d"
             d:DesignHeight="300" d:DesignWidth="300"><Grid x:Name="GrigliaTest"></Grid></UserControl>

VB XAML

Imports System.Windows.ControlsPublicClass UserControl1PublicSubNew()' Chiamata richiesta dalla finestra di progettazione.
        InitializeComponent()' Aggiungere le eventuali istruzioni di inizializzazione dopo la chiamata a InitializeComponent().EndSubPublicSub AddButton()Dim Btn AsNew Button
        Btn.Height ="50": Btn.Width ="50": GrigliaTest.Children.Add(Btn)EndSubEndClass

VB FORM

Imports WindowsApplication1.UserControl1PublicClass Form1Public Prova AsNew WindowsApplication1.UserControl1PrivateSub Form1_Load(ByVal sender As System.Object,ByVal e As System.EventArgs)HandlesMyBase.Load
        Prova.AddButton()EndSubEndClass

<o:p></o:p>

IlCasti<o:p></o:p>



Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>