No Content on programatic creation

3 posts, 0 answers
  1. michael mccurrey
    michael mccurrey avatar
    6 posts
    Member since:
    May 2008

    Posted 28 Jul 2009 Link to this post

    Environment: 
    WPF - XBAP style deployment
    Version 2009.2.701.35

    I'm trying to use the RadWindow to create a dynamic modal dialog from the code behind.

    I'm creating the RadWinow as such:

     

    var window = new RadWindow

     

    {

    WindowStartupLocation =

    WindowStartupLocation.CenterOwner,

     

    CanClose =

    true,

     

    CanMove =

    true,

     

    ResizeMode =

    ResizeMode.NoResize,

     

    Content =

    new UnhandledError(),

     

    Height = 300,

    Width = 500

    };

    window.ShowDialog();

    The problem is that the UserControl doesn't get displayed at all in the content.

    The UserControl is pure XAML as:

     

    <

     

    UserControl x:Class="PCSWeb.WPFShell.Views.UnhandledError"

     

     

     

     

     

     

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

     

     

     

     

     

     

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

     

     

     

     

     

     

    Height="300" Width="300" Name="window" Loaded="window_Loaded" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">

     

     

     

     

     

     

     

    <Grid Background="AliceBlue" Height="Auto" Width="Auto">

     

     

     

     

     

     

     

    <Grid.RowDefinitions>

     

     

     

     

     

     

     

    <RowDefinition />

     

     

     

     

     

     

     

    <RowDefinition />

     

     

     

     

     

     

     

    </Grid.RowDefinitions>

     

     

     

     

     

     

     

    <Grid.ColumnDefinitions>

     

     

     

     

     

     

     

    <ColumnDefinition Width="*" />

     

     

     

     

     

     

     

    </Grid.ColumnDefinitions>

     

     

     

     

     

     

     

    <Border Grid.Row="0" BorderBrush="#feca00" CornerRadius="0,10,20,40"

     

     

     

     

     

     

    BorderThickness="2" Height="Auto">

     

     

     

     

     

     

     

    <StackPanel>

     

     

     

     

     

     

     

     

    <TextBlock Text="Error">adafdfasdf</TextBlock>

     

     

     

     

     

     

     

    </StackPanel>

     

     

     

     

     

     

     

    </Border>

     

     

     

    </Grid>

     

    </

     

    UserControl>

     

     

     


     

  2. michael mccurrey
    michael mccurrey avatar
    6 posts
    Member since:
    May 2008

    Posted 28 Jul 2009 Link to this post

    nevermind fixed it..  you still need to call Initialize in your UserControl
  3. UI for WPF is Visual Studio 2017 Ready
  4. Hristo Borisov
    Admin
    Hristo Borisov avatar
    298 posts

    Posted 29 Jul 2009 Link to this post

    Hi Michael,

    Yes, you are required to call the Initialize in any case. It will map your xaml declared items to code-behind instances. If you have any other questions don't hesitate to contact us.

    Kind regards,
    Hristo Borisov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top