IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Windows Presentation Foundation Discussion :

inter opérabilité entre windows application form et xbap


Sujet :

Windows Presentation Foundation

  1. #1
    Membre du Club
    Inscrit en
    Avril 2010
    Messages
    101
    Détails du profil
    Informations forums :
    Inscription : Avril 2010
    Messages : 101
    Points : 68
    Points
    68
    Par défaut inter opérabilité entre windows application form et xbap
    Bonjour,
    J'essaye d'intégrer un objet "DateTimePicker" créer dans une windows application form dans une application xbap.

    voici le code du du fichier "page1.xaml.cs"
    ********************************************************
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    using System.Windows.Media;
    using System.Windows.Media.Imaging;
    using System.Windows.Navigation;
    using System.Windows.Shapes;
    using Winforms=System.Windows.Forms;
     
    namespace IntStat
    {
        /// <summary>
        /// Logique d'interaction pour Page1.xaml
        /// </summary>
        public partial class Page1 : Page
        {
     
            public Page1()
            {
     
                    InitializeComponent();
     
     
     
                Winforms.Application.EnableVisualStyles();
     
                // starting period date
                Winforms.DateTimePicker StartingTimespicker = new System.Windows.Forms.DateTimePicker();
                windowsFormsHost1.Child = StartingTimespicker;
               // StartingTimespicker.ValueChanged += new EventHandler(StartingTimespicker_changed );
     
     
               // Winforms.DateTimePicker EndingTimespicker = new System.Windows.Forms.DateTimePicker();
     
            }
     
            void StartingTimespicker_changed(object sender, EventArgs e)
            {
                Winforms.DateTimePicker StartingTimespicker = (Winforms.DateTimePicker)sender;
                //StartingPeriodDate = StartingTimespicker.Value;
     
            }
     
     
        }
    }
    **********************************************************
    celui du fichier page1.xaml est :
    **********************************************************

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    <Page x:Class="IntStat.Page1"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Page1" Height="419" Width="762">
     
        <Grid Height="420" Width="700">
     
            <TreeView HorizontalAlignment="Left" Margin="9,6,0,6" Name="treeView1" Width="115" />
     
            <ListBox Height="160" HorizontalAlignment="Left" Margin="133,6,0,0" Name="listBox1" VerticalAlignment="Top" Width="169" />
     
            <my:WindowsFormsHost HorizontalAlignment="Left" Margin="146,206,0,182" Name="windowsFormsHost1" Width="144" xmlns:my="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration" />
     
            <Rectangle Margin="133,171,0,90" Name="rectangle1" Stroke="Black" HorizontalAlignment="Left" Width="169" />
     
            <my:WindowsFormsHost Margin="146,0,0,119" Name="windowsFormsHost2" xmlns:my="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration" HorizontalAlignment="Left" Width="144" Height="32" VerticalAlignment="Bottom" />
     
            <Label HorizontalAlignment="Left" Margin="146,184,0,0" Name="label1" Width="98" Height="22" VerticalAlignment="Top">Période du </Label>
     
            <Label Height="22" HorizontalAlignment="Left" Margin="146,0,0,157" Name="label2" VerticalAlignment="Bottom" Width="98">au</Label>
     
        </Grid>
    </Page>
    **********************************************************
    l'erreur qui m'est renvoyée est la suivante:
    *********************************************************

    System.Windows.Markup.XamlParseException was unhandled
    Message: Cannot create instance of 'Page1' defined in assembly 'IntStat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Exception has been thrown by the target of an invocation. Error in markup file 'Page1.xaml' Line 1 Position 7.
    *********************************************************

    Est ce que l'un de vous pourrait avoir une idée?

    Merci de m'aider.

  2. #2
    Rédacteur
    Avatar de Nathanael Marchand
    Homme Profil pro
    Expert .Net So@t
    Inscrit en
    Octobre 2008
    Messages
    3 615
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 38
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Expert .Net So@t
    Secteur : Conseil

    Informations forums :
    Inscription : Octobre 2008
    Messages : 3 615
    Points : 8 082
    Points
    8 082
    Par défaut
    Les composants winforms ne sont pas super super compatibles avec WPF. Pourquoi ne pas prendre un datetimepicker wpf?

Discussions similaires

  1. TreeView sous windows application form
    Par mbarki.rachid dans le forum Windows
    Réponses: 1
    Dernier message: 03/05/2007, 15h20
  2. Difference entre MFC et Windows Application
    Par abbd dans le forum Visual C++
    Réponses: 2
    Dernier message: 27/02/2007, 13h18
  3. [VB.Net][debutant]passage de variable entre windows form
    Par ChristopheOce dans le forum Windows Forms
    Réponses: 1
    Dernier message: 26/07/2006, 14h18
  4. [Web services] Inter-opérabilité entre plateformes
    Par sicard_51 dans le forum Services Web
    Réponses: 5
    Dernier message: 14/03/2006, 11h27

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo