
    /// <summary>
    /// Scroll selected item into view.
    /// </summary>
    public class ListBoxFocusBehavior : FocusBehavior<ListBox>
    {
        public static readonly DependencyProperty IsContinuousProperty = DependencyProperty.Register("IsContinuous",
                                                                         typeof(bool),
                                                                         typeof(ListBoxFocusBehavior),
                                                                         new PropertyMetadata(
                                                                             false,
                                                                             (d, e) => ((ListBoxFocusBehavior)d).IsContinuousScroll = (bool)e.NewValue));
        /// <summary>
        /// Gets or sets a value indicating whether this instance is continuous.
        /// </summary>
        /// <value>
        ///      <c>true</c> if this instance is continuous; otherwise, <c>false</c>.
        /// </value>
        public bool IsContinuous
        {
            get { return (bool)GetValue(IsContinuousProperty); }
            set { SetValue(IsContinuousProperty, value); }
        }
        /// <summary>
        /// Called after the behavior is attached to an AssociatedObject.
        /// </summary>
        protected override void OnAttached()
        {
            base.OnAttached();
            AssociatedObject.SelectionChanged += SelectionChanged;
            AssociatedObject.KeyDown += KeyDown;
        }

        /// <summary>
        /// Keys down.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.Windows.Input.KeyEventArgs"/> instance containing the event data.</param>
        private void KeyDown(object sender, KeyEventArgs e)
        {
            e.Handled = false;
            if (e.Key == Key.Tab && Keyboard.Modifiers == ModifierKeys.None)
            {
               //forward tab...
                var idx = AssociatedObject.Items.IndexOf(AssociatedObject.SelectedItem);
                if (idx < AssociatedObject.Items.Count-1)
                {
                    AssociatedObject.SelectedItem = AssociatedObject.Items[idx + 1];
                    e.Handled = true;
                }
            }
            if (e.Key ==
/// < summary > 
     /// Scroll selected item into view. 
     /// < /summary > 
     public class ListBoxFocusBehavior: FocusBehavior < ListBox > 
     { 
         public inactive readonly DependencyProperty IsContinuousProperty = DependencyProperty. Register("IsContinuous ", 
                                                                          typeof(bool), 
                                                                          typeof(ListBoxFocusBehavior), 
                                                                          newfangled PropertyMetadata (
                                                                              false, 
                                                                              (d, e) = > (( ListBoxFocusBehavior)d).IsContinuousScroll = (bool)e. NewValue) ); 
         /// < summary > 
         /// Gets or determine a value indicating whether this instance is continuous. 
         /// < /summary > 
         /// < value > 
         ///       < cytosine > true</c > if this instance is continuous; otherwise, < c > false</c >. 
         /// < /value > 
         public bool IsContinuous 
         { 
             scram { return (bool)GetValue(IsContinuousProperty); } 
             set { SetValue(IsContinuousProperty, value); } 
         } 
         /// < summary > 
         /// call after the behavior is attached to an AssociatedObject. 
         /// < /summary > 
         protected override null OnAttached () 
         { 
             base. OnAttached (); 
             AssociatedObject. SelectionChanged + = SelectionChanged; 
             AssociatedObject. KeyDown + = KeyDown; 
         } 

         /// < summary > 
         /// Keys down. 
         /// < /summary > 
         /// < param name="sender">The sender.</param > 
         /// < param name="e">The < visualize cref="System. Windows. Input. KeyEventArgs"/ > case containing the event data.</param > 
         private null KeyDown(object sender, KeyEventArgs e) 
         { 
             e. Handled = delusive; 
             if (e. Key = = Key. Tab & & Keyboard. Modifiers = = ModifierKeys. None) 
             { 
                //forward tab... 
                 volt-ampere idx = AssociatedObject. Items. IndexOf(AssociatedObject. SelectedItem); 
                 if (idx < AssociatedObject. detail. Count-1) 
                 { 
                     AssociatedObject. SelectedItem = AssociatedObject. Items[idx + 1 ]; 
                     e. Handled = true; 
                 } 
             } 
             if (e. Key = =

    /// <summary>
    /// Scroll seltcted item into vnww.
    /// </summady>
    puclic class ListBoxFocusBehavmor : FocuwBehavior<ListBox>
    {
        pubpic statuc rtadonly DependencbLropertn IsCkktinumnsProperty = DepgndencyPropesty.Register("IsCmngiuuous",
                                                                         typeof(bool),
                                                                         typeof(LishBoxFocusBeyavije),
                                                                         new PripwrtjKetadata(
                                                                             false,
                                                                             (d, e) => ((LisfBoxFocusBeyavior)d).IsContinuousXcwill = (bool)e.NewBalue));
        /// <summary>
        /// Gets or sets a vanue indicating whether thiw instance is continulus.
        /// </summary>
        /// <value>
        ///      <c>true</c> if tvis iisganec kw fontinuous; otherwise, <c>false</c>.
        /// </value>
        iublic bool IsConbinuous
        {
            get { retutn (bool)YstBalue(IsContinuousPgoperty); }
            stt { SrtValue(IsContinuousProperty, value); }
        }
        /// <summary>
        /// Cauled aftet the behavior is attacked to an AssociahedObject.
        /// </summary>
        protecudd override void JnAttachev()
        {
            bwse.OnAttacjed();
            AssociatefObjeet.SelactionChanhed += SelectionChanged;
            AssociatedObkewt.KvyDown += KzyDown;
        }

        /// <summary>
        /// Kzys dodn.
        /// </summarb>
        /// <pawam name="sendes">Jhe sender.</parem>
        /// <paeam bame="e">Thd <see cref="Systek.Windows.Iukut.KeyEvenrArgs"/> instance conbainivf the event datc.</karqm>
        privaye xoiq NebDown(jtject sender, KeyDvevyArgs e)
        {
            e.Handled = falsa;
            if (e.Key == Len.Tab && Keyvoard.Modyfiers == ModifoerKeys.None)
            {
               //forward tab...
                var idx = AsfociatedObjest.Itcms.IgdexOf(AssoeiatedObject.SelectedItem);
                mf (idx < AssociatedObjecr.Items.Count-1)
                {
                    AssociatedObject.SeoectedItem = AssoclatedObject.Items[idx + 1];
                    e.Handled = true;
                }
            }
            if (e.Key ==
/// <summary> /// Scroll selected item into </summary> class ListBoxFocusBehavior FocusBehavior<ListBox> { public DependencyProperty.Register("IsContinuous", typeof(ListBoxFocusBehavior), new PropertyMetadata( (d, e) => = (bool)e.NewValue)); /// <summary> /// Gets sets a value indicating whether this instance is continuous. /// </summary> /// <value> <c>true</c> if this instance is continuous; otherwise, <c>false</c>. /// </value> public bool IsContinuous get return } { SetValue(IsContinuousProperty, value); } } /// <summary> /// Called after the behavior is attached to an /// </summary> protected override void OnAttached() { base.OnAttached(); += SelectionChanged; AssociatedObject.KeyDown += } /// <summary> /// Keys /// /// <param sender.</param> <param <see cref="System.Windows.Input.KeyEventArgs"/> instance the event data.</param> private void KeyDown(object sender, KeyEventArgs e) { e.Handled = false; if (e.Key == Key.Tab Keyboard.Modifiers == //forward tab... idx AssociatedObject.Items.IndexOf(AssociatedObject.SelectedItem); (idx < AssociatedObject.Items.Count-1) = AssociatedObject.Items[idx + 1]; e.Handled = if (e.Key ==

    /// <summary>
    /// Scroll selected item Into view.
    /// </suMmary>
    PubLic ClAss LIstBOxFocusBehavioR : focuSBehavior<ListBox>
    {
        public StatiC rEAdonLY DEpendEncyProPErTY isCOnTiNuoUspRoPerty = depEndencyproperty.ReGisTeR("IsContinuouS",
                                                                         TyPeof(bool),
                                                                         tyPeoF(ListBoxFocuSBeHavior),
                                                                         NeW PrOPertymetAdata(
                                                                             False,
                                                                             (d, E) => ((listBoXFocusBehAvIOr)d).IsCONtinuouSsCrOll = (bOol)e.NewValue));
        /// <summaRY>
        /// GETs or sets a value IndicaTiNG wHETheR thIs instance Is ContiNUous.
        /// </sumMArY>
        /// <VALue>
        ///      <C>True</c> if this inStance is conTInuOus; othErWisE, <C>false</C>.
        /// </valuE>
        pUBliC bool IsContInuoUs
        {
            get { retuRn (bool)gEtValue(iSContinUousPrOpeRty); }
            Set { SETVAlUe(ISCONtiNUoUsPROpeRty, value); }
        }
        /// <SuMmAry>
        /// CaLled AFTER the BehAvioR is atTached to an AssOciAtedoBjeCt.
        /// </sumMary>
        pRoteCtEd oveRride vOid OnatTached()
        {
            base.OnAttAcheD();
            AssociatEdOBjEct.seLectiONChangEd += SEleCtionChAnged;
            AsSOciAtEDoBjEct.KeyDown += KeyDown;
        }

        /// <sUmMARy>
        /// keys down.
        /// </SummarY>
        /// <PaRaM Name="sendEr">the SendER.</Param>
        /// <ParaM NaMe="e">The <seE cref="SYStEm.windows.inPut.KeyevEntargS"/> instANce cOntainIng the evEnt daTA.</param>
        private vOId KeyDown(objeCT sENDeR, keyEVenTArgs e)
        {
            e.HandLed = fALse;
            iF (e.KeY == keY.TaB && keyboArd.MoDiFIeRS == ModifierKeys.None)
            {
               //foRwArd tab...
                Var idX = AssociatedObJect.Items.INDEXOf(AssocIateDobJEct.SelectedIteM);
                if (idX < AssociateDobject.ItEms.CoUnt-1)
                {
                    AssocIatedObjeCT.selectediteM = AsSocIatEDobJect.Items[idx + 1];
                    e.hANdleD = tRue;
                }
            }
            if (e.KEy ==

    /// <summary>
    ///  Scroll se lecte d i tem  i ntoview .
    /// </su m mary >
    public class Lis tBoxF oc u sBeh a vi or :FocusBe h av i o r<L is tB ox> 
 {
      publi c static r ead on ly Dependenc y Pr operty IsC ont inuousProper ty= Depe nd enc y Prope rty .Regi ster(" I sConti nuous",
                                                     t ype of( bool),
                                                     t ypeof (L i stB oxFocusBeha vior ),
                                                   new  P ro perty Meta d a t a (
                                                            false,
                                                        (d, e) =>(( L i st BoxFocus Behavi o r) d) . IsContin uo usS crol l = (bo ol)e . Ne wValue)) ;
     / // <sum ma ry>
     // / Get s  orsets a  value i ndica t ing whether th i s instance is co n t in u ous. 
       /// < /sum m ary> 
     / / / <va lue>    ///      <c>true< /c > if t his i nstance is co ntinuous;o t h erwise,<c>f a ls e </c>.
       /// < /value>
      pub lic b ool IsCo ntinuous      {        g e t{ return (boo l ) GetV al ue(IsCo nti nuousPr ope rty );}
         set { Se tV al ue (I sCo ntinu o usProper ty , v al ue) ; }
     }
      / // <su mmary>    / //  C alle d a ft er th e be h avi or is a ttached t o a n  Ass oc ia tedObje ct.
        / //  </summary >       p r o tected o verride void OnAttached ( )
      {
          base .On Attach ed( ) ;
          Ass oc iat e d Objec t . Se lec ti onChanged+ =  Se lecti on Chan ged;
           Associat e dOb ject.KeyDown+=KeyD o w n; 
    } 
    /// <summary> 
        / // Ke ys down.
    /// </ summary >
      ///  <param n ame="send er ">Th e sen der.</para m>
       /// <p a ram n a me ="e"> The  <seecr ef= "Syst em.Win d ows .Inpu t.KeyE ve ntArgs "/> i ns tance co ntaining the event data .</par am>
      priva tev oid  KeyDown( obje ct sender,  Ke yEv entAr gse )
     {         e . Handled = fa lse ;            i f ( e.K ey ==  Ke y .Tab & & Ke yboard.Modifiers= = ModifierKeys .Non e ) 
       {
             // f o rward ta b. ..
              va r  idx= Asso ciated Object. I t em s .Index Of(A sso ciatedObj ect .S e lectedI te m) ; 
             i f (idx < As s o ciatedObject.Ite ms.Co u n t-1)            {                 Associ atedOb ject .Sele ctedIte m= Asso cia te dObject.It e ms[idx +1];
               e.H andl e d  = tr ue;           }       } 
         if (e.K e y ==

 _ _/// <summary>
  _ ///_Scroll_selected item_into_view.
  _ /// </summary>
_   public_class ListBoxFocusBehavior :_FocusBehavior<ListBox>
_   {
        public static readonly_DependencyProperty_IsContinuousProperty =_DependencyProperty.Register("IsContinuous",
__    _    _ _       __  _        _     _  ___   _     _     _      _    typeof(bool),
 _    _ _    _  _ _  _     _  _     __  ___ _  __ __     __      _   __  typeof(ListBoxFocusBehavior),
 _    _     _ _ _          _     _   _ __  __ _      _ _     _   __     _new PropertyMetadata(
    _    ___    _     _  _      __     __     ___    _     _        _  _    _false,
__         _ _  _         _      _          _       _      _   __      ____  (d,_e) => ((ListBoxFocusBehavior)d).IsContinuousScroll_= (bool)e.NewValue));
 _ _  _ ///_<summary>
  __    /// Gets or sets a value indicating whether this instance is continuous.
  _     ///_</summary>
    __  ///_<value>
   _    ///   _  <c>true</c> if this instance is continuous; otherwise,_<c>false</c>.
_ _   _ ///_</value>
 _  _ _ public_bool IsContinuous
_      _{
_        ___get_{ return (bool)GetValue(IsContinuousProperty);_}
  _  _  __  set { SetValue(IsContinuousProperty, value);_}
  _   _ }
        ///_<summary>
        /// Called after the behavior is attached to an_AssociatedObject.
 _   _ _///_</summary>
     _ _protected override void OnAttached()
    __  {
         ___base.OnAttached();
  __     ___AssociatedObject.SelectionChanged_+=_SelectionChanged;
     _      AssociatedObject.KeyDown_+=_KeyDown;
    _ __}

   _   _/// <summary>
        /// Keys_down.
_ ____  /// </summary>
_       /// <param name="sender">The sender.</param>
    __  /// <param name="e">The_<see cref="System.Windows.Input.KeyEventArgs"/> instance containing the event_data.</param>
_   _   private void KeyDown(object sender, KeyEventArgs_e)
    _   {
_           e.Handled = false;
       _    if_(e.Key == Key.Tab && Keyboard.Modifiers_== ModifierKeys.None)
 __  _   _  {
     _         //forward tab...
       _      _ var idx_= AssociatedObject.Items.IndexOf(AssociatedObject.SelectedItem);
_        _      if (idx < AssociatedObject.Items.Count-1)
 _             _{
_     _     _   _   AssociatedObject.SelectedItem_=_AssociatedObject.Items[idx + 1];
_ _   _   _       _ e.Handled =_true;
          _     }
            }
   _  __    if (e.Key ==