This question is locked. New answers and comments are not allowed.
Can you give me an example walkthrough how to implement a custom Silverlight control, which inherits your RadMenu control for example ? So I can extend the functionallity the way I need it to.
Thanks.
Edit:
Let me explain why I am asking this question and what problems I have.
I have a CustomControl for example called MyControl. That is the .xaml file of the control:
This is what I have made in the .cs file of the control:
In my other CustomControl, which is a container, I want to use MyControl and I add it like this:
But when I try to run this application (the build is OK), I get this Exception:
Thanks.
Edit:
Let me explain why I am asking this question and what problems I have.
I have a CustomControl for example called MyControl. That is the .xaml file of the control:
| <UserControl x:Class="SilverlightCustomControls.MyControl" |
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| Width="400" Height="300"> |
| </UserControl> |
This is what I have made in the .cs file of the control:
| using Telerik.Windows.Controls; |
| namespace SilverlightCustomControls |
| { |
| public partial class MyControl : RadMenu |
| { |
| public MyControl() |
| { |
| InitializeComponent(); |
| } |
| } |
| } |
In my other CustomControl, which is a container, I want to use MyControl and I add it like this:
| <UserControl x:Class="SilverlightCustomControls.MyContainterClass" |
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| xmlns:custom="clr-namespace:SilverlightCustomControls;assembly=SilverlightCustomControls"> |
| <Grid x:Name="LayoutRoot"> |
| <Grid.RowDefinitions> |
| <RowDefinition Height="26" /> |
| <RowDefinition Height="26" /> |
| <RowDefinition Height="*" /> |
| </Grid.RowDefinitions> |
| <custom:MyControl Name="MainMenu" Grid.Row="0"> |
| <custom:MyControl.Background> |
| <LinearGradientBrush EndPoint="0.0,1.0" StartPoint="0.0,0.0"> |
| <GradientStop Color="Gold" Offset="0.0"/> |
| <GradientStop Color="White" Offset="0.2"/> |
| <GradientStop Color="Gold" Offset="0.8"/> |
| <GradientStop Color="Goldenrod" Offset="1"/> |
| </LinearGradientBrush> |
| </custom:MyControl.Background> |
| </custom:MyControl> |
| </Grid> |
| </UserControl> |
But when I try to run this application (the build is OK), I get this Exception:
| System.Windows.Markup.XamlParseException occurred |
| Message="Cannot specify the value multiple times for property: MyControl.Background. [Line: 20 Position: 45]" |
| LineNumber=20 |
| LinePosition=45 |
| StackTrace: |
| at System.Windows.Application.LoadComponent(Object component, Uri xamlUri) |
| at SilverlightCustomControls.MyContainterControl.InitializeComponent() |
| at SilverlightCustomControls.MyContainterControl..ctor() |
| InnerException: |