How create a inherited window ?

2 posts, 0 answers
  1. Gilmar
    Gilmar avatar
    19 posts
    Member since:
    Jul 2010

    Posted 04 Oct 2010 Link to this post

    HI,

    I created a base page with a window control decribed below

    <telerik:RadWindow x:Class="SilverlightApplication4.Views.Base.BasePage" 
               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"
               xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
               mc:Ignorable="d"
               xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
               d:DesignWidth="640" d:DesignHeight="480">
        <Grid x:Name="LayoutRoot" Background="Gray">         
                 <telerik:RadButton Command="{Binding InsertCommand}" Content="Novo" Height="22" HorizontalAlignment="Left" Margin="85,12,0,0" Name="btnNovo" UseLayoutRounding="False" VerticalAlignment="Top" Width="67" Click="btnNovo_Click" />
                <telerik:RadButton Command="{Binding EditCommand, Mode=TwoWay}" Content="Editar" Height="22" HorizontalAlignment="Left" Margin="158,12,0,0" Name="btnEditar" UseLayoutRounding="False" VerticalAlignment="Top" Width="67" />
                <telerik:RadButton Command="{Binding DeleteCommand}" CommandParameter="{Binding ItemSelecionado}" Content="Excluir" Height="22" HorizontalAlignment="Left" Margin="229,12,0,0" Name="btnExcluir" UseLayoutRounding="False" VerticalAlignment="Top" Width="67" />
                <telerik:RadButton Command="{Binding CancelCommand}" IsEnabled="{Binding EmEdicao}" Content="Cancelar" Height="22" HorizontalAlignment="Left" Margin="302,12,0,0" Name="btnCancelar" UseLayoutRounding="False" VerticalAlignment="Top" Width="67" />
                <telerik:RadButton Command="{Binding SaveCommand}" Content="Salvar" Height="22" HorizontalAlignment="Left" Margin="375,12,0,0" Name="btnSalvar" UseLayoutRounding="False" VerticalAlignment="Top" Width="67" />

        </Grid>
    </telerik:RadWindow>

    and want to create another page that inherit this base class. So all my pages would have search buttons and editing as can be seen in the base class.
    I tried as shown in the code below, but the application gives error.
    How can I implement this proper functionality?
    <BasePage x:Class="SilverlightApplication4.Views.Page1" 
               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"
               xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"               
               mc:Ignorable="d"
               xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
               d:DesignWidth="640" d:DesignHeight="480"
               Title="Page1 Page">
        <Grid x:Name="LayoutRoot">

        </Grid>
    </BasePage>








  2. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 07 Oct 2010 Link to this post

    Hi Gilmar,

     This is not the correct way to achieve this. The XAML of the Window actually changes its Content property and when inheriting it the second time you change the Content and your search button is removed. The correct way to do this is to change either the Template or the ContentTemplate of the RadWindow control in the first XAML file.

    Hope this helps!

    Kind regards,
    Miroslav Nedyalkov
    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
  3. DevCraft banner
Back to Top