This is a migrated thread and some comments may be shown as answers.

Adding contents to RadWindow

10 Answers 268 Views
Window
This is a migrated thread and some comments may be shown as answers.
Satish J
Top achievements
Rank 1
Satish J asked on 08 Dec 2009, 11:10 AM
Hi,

    Iam inheriting RadWindow. Pls let me know how to add controls to it using xaml. Also, let me know how to set the 

IconContent property of the RadConfirm dialog.

Any quick response is much appreciated.

Thanks,
Satish

10 Answers, 1 is accepted

Sort by
0
Miroslav Nedyalkov
Telerik team
answered on 09 Dec 2009, 01:27 PM
Hello Satish,

I would recommend you to inherit the RadWindow control in XAML. In this way it is straight-forward to add any content to it. Please, refer to attached example.

About the Icon property - the RadConfirm control doesn't support such feature. If need to do this, you need to change the ControlTemplate of the RadConfirm control. If you are going to use your custom confirm control and custom confirm methods (like you said in one of your posts) you could just put your Icon in the control template of your custom control. If you need to change it dynamically you could add a property for this and to template-bind the image in the control template to this property.

Hope this information helps.


Best wishes,
Miroslav Nedyalkov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Charles Macleod
Top achievements
Rank 1
answered on 10 Mar 2010, 04:25 AM
Hi Miroslav,
Could you post the sample? I don't see it on the post

thanks
0
Konstantina
Telerik team
answered on 11 Mar 2010, 02:00 PM
Hi Charles,

Thank you for contacting us.

Sorry for the oversight. Attached you will find a sample project which illustrates the use of the RadWindow. 

If you have any other questions please feel free to contact us again.

Regards,
Konstantina
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Le_Roy
Top achievements
Rank 2
answered on 15 Jun 2010, 12:47 PM
Hello. Got some troubles..
I'm trying to inherit from radwindow in my usercontrol(lets call it container), which contains other user control(and that is indicator)..

Got error something like "3521 Xaml parse exception..Failed to set UIElement.Loaded"
Container xaml:
<telerikNavigation:RadWindow  
  x:Class="My.Systems.Imhotep.Pages.Controls.DataWindow" 
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
  xmlns:telerikNavigation="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation" 
  xmlns:telerikControls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls" 
  xmlns:MyControls="clr-namespace:My.Controls;assembly=My.Controls" 
  IsRestricted="True" Height="600">  
 
  <telerikNavigation:RadWindow.ContentTemplate> 
    <DataTemplate> 
      <Grid Background="White">  
        <Grid.RowDefinitions> 
          <RowDefinition/> 
          <RowDefinition Height="20"/>  
        </Grid.RowDefinitions> 
        <ScrollViewer telerikControls:StyleManager.Theme="Windows7" VerticalScrollBarVisibility="Visible">  
          <ContentPresenter Grid.Row="0" Content="{Binding Content, RelativeSource={RelativeSource TemplatedParent}}"/>  
        </ScrollViewer> 
        <MyControls:ProgressBar x:Name="Indicator" Loaded="Indicator_Loaded" Grid.Row="1" Margin="5,0,5,0"/>  
      </Grid> 
    </DataTemplate> 
  </telerikNavigation:RadWindow.ContentTemplate> 
 
</telerikNavigation:RadWindow> 

Container code-behind:
 
using System;  
using System.Windows;  
 
using ProgressBar = My.Controls.ProgressBar;  
 
namespace My.Systems.Imhotep.Pages.Controls  
{  
  public partial class DataWindow  
  {  
    private ProgressBar _indicator;  
 
    public delegate void EventHandler(object sender, EventArgs e);  
    public event EventHandler ControlsLoaded;  
 
    public DataWindow()  
    {  
      InitializeComponent();  
    }  
 
    private void Indicator_Loaded(object sender, RoutedEventArgs e)  
    {  
      _indicator = (ProgressBar) sender;  
      _indicator.HorizontalAlignment = HorizontalAlignment.Right;  
      RaiseControlsLoaded(new EventArgs());  
    }  
 
    public void StartProgress() { _indicator.Start(); }  
 
    public void StopProgress() { _indicator.Stop(); }  
 
    private void RaiseControlsLoaded(EventArgs e)  
    {  
      if (ControlsLoaded != null)  
      {  
        ControlsLoaded(this, e);  
      }  
    }  
  }  

Indicator xaml:
<UserControl  
  x:Class="My.Controls.ProgressBar" 
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
  xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
  mc:Ignorable="d" 
  d:DesignHeight="300" d:DesignWidth="400">  
 
  <Grid x:Name="layoutRoot" Background="Transparent">  
    <Grid.ColumnDefinitions> 
      <ColumnDefinition/> 
      <ColumnDefinition/> 
    </Grid.ColumnDefinitions> 
  </Grid> 
</UserControl> 

Indicator codebehind:
 
using System.Windows;  
using System.Windows.Controls;  
using Telerik.Windows.Controls;  
 
namespace My.Controls  
{  
  public partial class ProgressBar  
  {  
    public ProgressBar()  
    {  
      InitializeComponent();  
    }  
 
    public void Start()  
    {  
      if (layoutRoot.Children.Count != 0)  
        return;  
 
      var messageLabel = new Label {Content = "Загрузка Ð´Ð°Ð½Ð½Ñ‹Ñ…..."};  
      messageLabel.SetValue(Grid.ColumnProperty, 0);  
 
      var progressBar = new RadProgressBar  
      {  
        Visibility = Visibility.Visible,  
        IsIndeterminate = true,  
        Width = 150,  
        Height = 20,  
        Minimum = 0,  
        Maximum = 1000,  
        FlowDirection = FlowDirection.RightToLeft  
      };  
      progressBar.SetValue(Grid.ColumnProperty, 1);  
      layoutRoot.Children.Add(messageLabel);  
      layoutRoot.Children.Add(progressBar);  
    }  
 
    public void Stop() { layoutRoot.Children.Clear(); }  
  }  

Where I'm using container xaml:
<MyControls:DataWindow  
  x:Class="My.Systems.Imhotep.Pages.Status.PrimaryDocument" 
  xmlns:telerikGridView="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView" 
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
  xmlns:telerikNavigation="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation" 
  xmlns:telerikControls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls" 
  xmlns:Controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.Input" 
  xmlns:liquidRichText="clr-namespace:Liquid;assembly=Liquid.RichText" 
  xmlns:MyPageControls="clr-namespace:My.Systems.Imhotep.Pages.Controls" 
  xmlns:MyControls="clr-namespace:My.Controls;assembly=My.Controls" 
  IsRestricted="True" Height="600">  
 
    <Grid x:Name="LayoutRoot" Background="Transparent" Width="660" Margin="10">  
      <Grid.ColumnDefinitions> 
        <ColumnDefinition/> 
        <ColumnDefinition Width="200"/>  
        <ColumnDefinition Width="200"/>  
        <ColumnDefinition/> 
      </Grid.ColumnDefinitions> 
      <Grid.RowDefinitions> 
        <RowDefinition/> 
        <RowDefinition/> 
        <RowDefinition/> 
        <RowDefinition/> 
        <RowDefinition/> 
        <RowDefinition/> 
        <RowDefinition/> 
        <RowDefinition/> 
        <RowDefinition/> 
        <RowDefinition/> 
      </Grid.RowDefinitions> 
 
      <Controls:Label x:Name="descriptionLabel" Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="0"/>  
    </Grid> 
</MyControls:DataWindow> 
Where I'm using container codebehind:
using System;  
using System.Windows;  
using System.Windows.Browser;  
using System.Windows.Controls;  
using System.Windows.Data;  
using My.Systems.Imhotep.App_Code;  
using My.Systems.Imhotep.Gor;  
using My.Systems.Imhotep.Hma;  
using My.Systems.Imhotep.Pages.Controls;  
using My.Systems.Imhotep.Pages.Popup;  
using Telerik.Windows.Controls;  
 
using WindowStartupLocation = Telerik.Windows.Controls.WindowStartupLocation;  
 
namespace My.Systems.Imhotep.Pages.Status  
{  
  public partial class PrimaryDocument  
  {  
 
    public PrimaryDocument() { }  
 
    public PrimaryDocument(long documentGuid)  
    {  
      Header = Localization.Pages.Status_PrimaryDocument_Header + _documentGuid;  
      ResizeMode = ResizeMode.CanResize;  
      RestrictedAreaMargin = Helper.WindowRestrictionMargin;  
      WindowStartupLocation = WindowStartupLocation.CenterScreen;  
 
      InitializeComponent();  
      StartProgress();  
      StopProgress();  
    }  
  }  
0
Konstantina
Telerik team
answered on 18 Jun 2010, 04:00 PM
Hi Le_Roy,

Thank you for the code snippets.

We tried to reproduce the issue following your code, but to no avail. In order to track down the source of the problem could you be so kind to send us a sample project which we can run here locally.

Looking forward to your reply.

Best wishes,
Konstantina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Le_Roy
Top achievements
Rank 2
answered on 17 Jul 2010, 09:51 AM
Sorry for a waiting time..
Here is my sample project.

http://rapidshare.com/files/407417604/DataWindow.rar
0
Konstantina
Telerik team
answered on 22 Jul 2010, 10:08 AM
Hello Le_Roy,

Thank you for your sample project.

Initialy, having xaml in both UserControls - Container and Window - is not a good practise. The error is because it is trying to call the Loaded handler from code-behind of the inherited class, not from the parent in which code-behind the handler is handled. If you place the Loaded event handler in the code-behind of the inherited class the exception will disappear, but this is not recommended.
Could you please share with us what is your scenario - why do you need to inherit the RadWindow like this? In that way we will be able to assist you in the best manner.

If you have further inquiries please let us know.

Best wishes,
Konstantina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Le_Roy
Top achievements
Rank 2
answered on 22 Jul 2010, 03:20 PM
I want to create window having option to indicate loading indicator "out of the box".
When my custom controls inside that window accessing webservices, i want to indicate it in generic manner.
0
Konstantina
Telerik team
answered on 26 Jul 2010, 11:31 AM
Hi Le_Roy,

Since Q2 2010 we have added a new control to the package - RadBusyIndicator. I think it will fit your needs. You can put it in the ContentTemplate of the Window. You can find examples on its use here.

If you need further assistance please feel free to contact us again.

Kind regards,
Konstantina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Le_Roy
Top achievements
Rank 2
answered on 26 Jul 2010, 07:49 PM
In my example project I used RadBusyIndicator.
Thanks anyway. I'll try to find another way to achieve my goals.
Tags
Window
Asked by
Satish J
Top achievements
Rank 1
Answers by
Miroslav Nedyalkov
Telerik team
Charles Macleod
Top achievements
Rank 1
Konstantina
Telerik team
Le_Roy
Top achievements
Rank 2
Share this question
or