Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4066730
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T16:09:48+00:00 2026-05-20T16:09:48+00:00

I’m having trouble adding controls with x:name to my custom control. Adding the x:name=startDate

  • 0

I’m having trouble adding controls with x:name to my custom control.

Adding the x:name=”startDate” causes everything to break. Otherwise this works perfectly.

I have a custom control inheriting from ItemsControl.

using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace ControlCSI
{
    public partial class SlideMenu : ItemsControl
    {
        public SlideMenu()
        {
            // Required to initialize variables
            InitializeComponent();
        }
    }
}

Here is the markup definition of that class

<ItemsControl
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"
x:Class="ControlCSI.SlideMenu"
d:DesignWidth="200" d:DesignHeight="800">

<ItemsControl.ItemsPanel>
    <ItemsPanelTemplate>
        <StackPanel Orientation="Vertical" />
    </ItemsPanelTemplate>
</ItemsControl.ItemsPanel>

<ItemsControl.Template>
    <ControlTemplate TargetType="ItemsControl">
        <Grid x:Name="LayoutRoot">
            <Border Height="auto" Grid.Column="0" CornerRadius="5" >
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="23" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    <Border Background="Transparent">
                        <Image Source="/ControlCSI;component/Images/GlossyBlack/bg_pulltab.png"  />
                    </Border>
                    <Grid Grid.Column="1" >
                        <Border CornerRadius="10,0,0,10" BorderBrush="#11c2f1" BorderThickness="0">
                            <Border.Background>
                                <ImageBrush  ImageSource="/ControlCSI;component/Images/GlossyBlack/bg_nav.png"/>
                            </Border.Background>
                            <ItemsPresenter />
                        </Border>
                    </Grid>
                </Grid>
            </Border>
        </Grid>
    </ControlTemplate>
</ItemsControl.Template>    

and here is the implementation:

<ControlCSI:SlideMenu x:Name="SlideOutMenu" Width="200" VerticalAlignment="Stretch"  HorizontalAlignment="Right" RenderTransformOrigin="0.5,0.5" >
            <ControlCSI:SlideMenu.RenderTransform>
                <CompositeTransform TranslateX="180"/>
            </ControlCSI:SlideMenu.RenderTransform>

            <telerik:RadButton Margin="5,10,5,0"  Click="RadButton_Click" Tag="30" Content="30 Days" Style="{StaticResource SliderButton}"  />
            <telerik:RadButton  Click="RadButton_Click" Tag="60" Content="60 Days" Style="{StaticResource SliderButton}"/>
            <telerik:RadButton  Click="RadButton_Click" Tag="90" Content="3 Months" Style="{StaticResource SliderButton}"/>
            <telerik:RadButton  Click="RadButton_Click" Tag="180" Content="6 Months" Style="{StaticResource SliderButton}"/>
            <telerik:RadDatePicker x:Name="startDate" x:Uid="startDate"  DropDownOpened="startDate_DropDownOpened" DropDownClosed="startDate_DropDownClosed"    DateTimeWatermarkContent="Start Date" Style="{StaticResource SliderDatePicker}"  Template="{StaticResource RadDateTimePickerControlTemplate1}"  />
            <telerik:RadDatePicker  DropDownOpened="startDate_DropDownOpened" DropDownClosed="startDate_DropDownClosed"    DateTimeWatermarkContent="End Date" Style="{StaticResource SliderDatePicker}" Template="{StaticResource RadDateTimePickerControlTemplate1}"  />


        </ControlCSI:SlideMenu>

errors:

  A first chance exception of type 'System.NullReferenceException' occurred in ControlCSI
System.Windows.Data Error: BindingExpression path error: 'ErrorResources' property not found on 'ControlCSI.ResourceWrapper' 'ControlCSI.ResourceWrapper' (HashCode=42863040). BindingExpression: Path='ErrorResources.ErrorWindowTitle' DataItem='ControlCSI.ResourceWrapper' (HashCode=42863040); target element is 'ControlCSI.ErrorWindow' (Name=''); target property is 'Title' (type 'System.Object')..
System.Windows.Data Error: BindingExpression path error: 'ErrorResources' property not found on 'ControlCSI.ResourceWrapper' 'ControlCSI.ResourceWrapper' (HashCode=42863040). BindingExpression: Path='ErrorResources.ErrorWindowGenericError' DataItem='ControlCSI.ResourceWrapper' (HashCode=42863040); target element is 'System.Windows.Controls.TextBlock' (Name='IntroductoryText'); target property is 'Text' (type 'System.String')..
System.Windows.Data Error: BindingExpression path error: 'ErrorResources' property not found on 'ControlCSI.ResourceWrapper' 'ControlCSI.ResourceWrapper' (HashCode=42863040). BindingExpression: Path='ErrorResources.ErrorWindowErrorDetails' DataItem='ControlCSI.ResourceWrapper' (HashCode=42863040); target element is 'System.Windows.Controls.TextBlock' (Name='LabelText'); target property is 'Text' (type 'System.String')..

x:name creates a local variable so i am guessing that this is a namespace issue ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T16:09:49+00:00Added an answer on May 20, 2026 at 4:09 pm

    In the end I switched to a UserControl (which after some documentation review was the right way to go).

    I added the buttons and date pickers inside of the control and and exposed them by binding to dependency properties.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
We're building an app, our first using Rails 3, and we're having to build
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have some data like this: 1 2 3 4 5 9 2 6
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
That's pretty much it. I'm using Nokogiri to scrape a web page what has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.