protected override void OnPreRender(EventArgs e)
 {
     if (mMapping == null)
     {
         Visible = false;
     }
     else
     {
         ItemRepeater.DataSource = mMapping.Items;
         ItemRepeater.DataBind();
         if (String.IsNullOrEmpty(mMapping.ExternalIdentifierAttributeName))
         {
             MessageControl.InnerHtml = GetString("sf.noexternalidentifierattribute");
             MessageControl.Attributes.Add("class", "Red");
             MessageControl.Visible = true;
         }
         else
         {
             MessageControl.InnerHtml = String.Format("{0}: {1}", GetString("sf.mapping.externalidentifierattribute"), HTMLHelper.HTMLEncode(mMapping.ExternalIdentifierAttributeLabel));
             MessageControl.Visible   = true;
         }
         if (!Enabled)
         {
             ContainerControl.Attributes.Add("class", "Gray");
         }
     }
 }
        private void OnLoaded(object sender, RoutedEventArgs e)
        {
            if (index == 0)
            {
                return;
            }

            var element = ItemRepeater.GetOrCreateElement(index);

            // ensure the item is given a valid position
            element.UpdateLayout();
            element.StartBringIntoView(new BringIntoViewOptions()
            {
                VerticalOffset = relativeVerticalOffset
            });
        }