Tuesday, July 13, 2010

DXWindow and DXDialog as Silverlight a UserControl

Here is a quick example of making a DXDialog or DXWindow a user control in your Silverlight applications.

Add a reference to DevExpress.xpf.Core to you Silverlight application.

Modify the xaml so that it is a DXWindow (or DXDialog).

<dec:DXDialog x:Class="DevExpressWindow.Dialog"
    d:DesignHeight="300" d:DesignWidth="400">    
    <Grid x:Name="LayoutRoot" Background="White">
        <TextBlock Text="Your UI here." HorizontalAlignment="Center" VerticalAlignment="Center"/>




And modify the code behind so that instead of deriving from UserControl, derive from DXwindow (or DXDialog) like so.

using System;
using DevExpress.Xpf.Core;

namespace DevExpressWindow
    public partial class Dialog : DXDialog
        public Dialog()


And to use it from within the application

  private void btnNewDialog_Click(object sender, RoutedEventArgs e)
            Dialog dlg = new Dialog { Title = "My Dialog",Height=200 };


The result is a reusable dialog or window.



No comments: