public void setCustomViewBehind(CustomViewBehind cvb)
 {
     mViewBehind = cvb;
     setInternalPageChangeListener(new InternalPageChangeListener(mViewBehind));
 }
        /**
         * Instantiates a new SlidingMenu.
         *
         * @param context the associated Context
         * @param attrs the attrs
         * @param defStyle the def style
         */
        public SlidingMenu(Context context, IAttributeSet attrs, int defStyle)
            : base(context, attrs, defStyle)
        {


            LayoutParams behindParams = new LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent);
            mViewBehind = new CustomViewBehind(context);
            AddView(mViewBehind, behindParams);
            LayoutParams aboveParams = new LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent);
            mViewAbove = new CustomViewAbove(context);
            AddView(mViewAbove, aboveParams);
            // register the CustomViewBehind with the CustomViewAbove
            mViewAbove.setCustomViewBehind(mViewBehind);
            mViewBehind.setCustomViewAbove(mViewAbove);

            mViewAbove.setOnPageChangeListener(new PageChangeClass(mOpenListener, mCloseListener, mSecondaryOpenListner));
            //mViewAbove.setOnPageChangeListener(new OnPageChangeListener() {
            //    public static readonly int POSITION_OPEN = 0;
            //    public static readonly int POSITION_CLOSE = 1;
            //    public static readonly int POSITION_SECONDARY_OPEN = 2;

            //    public void onPageScrolled(int position, float positionOffset,
            //            int positionOffsetPixels) { }

            //    public void onPageSelected(int position) {
            //        if (position == POSITION_OPEN && mOpenListener != null) {
            //            mOpenListener.onOpen();
            //        } else if (position == POSITION_CLOSE && mCloseListener != null) {
            //            mCloseListener.onClose();
            //        } else if (position == POSITION_SECONDARY_OPEN && mSecondaryOpenListner != null ) {
            //            mSecondaryOpenListner.onOpen();
            //        }
            //    }
            //});

            // now style everything!
            TypedArray ta = context.ObtainStyledAttributes(attrs, Resource.Styleable.SlidingMenu);
            // set the above and behind views if defined in xml
            SlidingMenuMode mode = (SlidingMenuMode)ta.GetInt(Resource.Styleable.SlidingMenu_mode, (int)SlidingMenuMode.LEFT);
            this.Mode=mode;
            int viewAbove = ta.GetResourceId(Resource.Styleable.SlidingMenu_viewAbove, -1);
            if (viewAbove != -1)
            {
                setContent(viewAbove);
            }
            else
            {
                setContent(new FrameLayout(context));
            }
            int viewBehind = ta.GetResourceId(Resource.Styleable.SlidingMenu_viewBehind, -1);
            if (viewBehind != -1)
            {
                setMenu(viewBehind);
            }
            else
            {
                setMenu(new FrameLayout(context));
            }
            int touchModeAbove = ta.GetInt(Resource.Styleable.SlidingMenu_touchModeAbove, TOUCHMODE_MARGIN);
            setTouchModeAbove(touchModeAbove);
            int touchModeBehind = ta.GetInt(Resource.Styleable.SlidingMenu_touchModeBehind, TOUCHMODE_MARGIN);
            setTouchModeBehind(touchModeBehind);

            int offsetBehind = (int)ta.GetDimension(Resource.Styleable.SlidingMenu_behindOffset, -1);
            int widthBehind = (int)ta.GetDimension(Resource.Styleable.SlidingMenu_behindWidth, -1);
            if (offsetBehind != -1 && widthBehind != -1)
                throw new Java.Lang.IllegalStateException("Cannot set both behindOffset and behindWidth for a SlidingMenu");
            else if (offsetBehind != -1)
                setBehindOffset(offsetBehind);
            else if (widthBehind != -1)
                setBehindWidth(widthBehind);
            else
                setBehindOffset(0);
            float scrollOffsetBehind = ta.GetFloat(Resource.Styleable.SlidingMenu_behindScrollScale, 0.33f);
            setBehindScrollScale(scrollOffsetBehind);
            int shadowRes = ta.GetResourceId(Resource.Styleable.SlidingMenu_shadowDrawable, -1);
            if (shadowRes != -1)
            {
                setShadowDrawable(shadowRes);
            }
            int shadowWidth = (int)ta.GetDimension(Resource.Styleable.SlidingMenu_shadowWidth, 0);
            setShadowWidth(shadowWidth);
            bool fadeEnabled = ta.GetBoolean(Resource.Styleable.SlidingMenu_fadeEnabled, true);
            setFadeEnabled(fadeEnabled);
            float fadeDeg = ta.GetFloat(Resource.Styleable.SlidingMenu_fadeDegree, 0.33f);
            setFadeDegree(fadeDeg);
            bool selectorEnabled = ta.GetBoolean(Resource.Styleable.SlidingMenu_selectorEnabled, false);
            setSelectorEnabled(selectorEnabled);
            int selectorRes = ta.GetResourceId(Resource.Styleable.SlidingMenu_selectorDrawable, -1);
            if (selectorRes != -1)
                setSelectorDrawable(selectorRes);
            ta.Recycle();
        }
 public InternalPageChangeListener(CustomViewBehind mViewBehind)
 {
     // TODO: Complete member initialization
     this.mViewBehind = mViewBehind;
 }