コード例 #1
0
 private void Lbl_Desc_MouseUp(object sender, MouseButtonEventArgs e)
 {
     if (TB_Desc.Visibility == Visibility.Hidden)
     {
         TB_Desc.Visibility = Visibility.Visible;
         TB_Desc.Focus();
     }
 }
コード例 #2
0
        private void BindingInit()
        {
            Binding binduname = new Binding()
            {
                Source = Account.Instance,
                Path   = new PropertyPath("UName"),
                Mode   = BindingMode.OneWay
            };

            TBk_UserName.SetBinding(TextBlock.TextProperty, binduname);

            Binding bindface = new Binding()
            {
                Source = Account.Instance,
                Path   = new PropertyPath("Pic"),
                Mode   = BindingMode.OneWay
            };

            Img_Face.SetBinding(Image.SourceProperty, bindface);

            Binding binddesc = new Binding()
            {
                Source = Account.Instance,
                Path   = new PropertyPath("Desc"),
                Mode   = BindingMode.OneWay
            };

            TB_Desc.SetBinding(TextBox.TextProperty, binddesc);

            Binding bindlevel = new Binding()
            {
                Source             = Account.Instance,
                Path               = new PropertyPath("Level"),
                Mode               = BindingMode.OneWay,
                Converter          = new WidthNHeightValue_Times_Converter(),
                ConverterParameter = -36.5
            };

            Img_level.SetBinding(Canvas.TopProperty, bindlevel);

            Binding bindlevelprocess = new Binding()
            {
                Source             = Account.Instance,
                Path               = new PropertyPath("ExpProgress"),
                Mode               = BindingMode.OneWay,
                Converter          = new WidthNHeightValue_Times_Converter(),
                ConverterParameter = 398
            };

            Bar_level_top.SetBinding(WidthProperty, bindlevelprocess);

            Binding bindlevelprocessstr = new Binding()
            {
                Source = Account.Instance,
                Path   = new PropertyPath("str_ExpProgress"),
                Mode   = BindingMode.OneWay,
            };

            LevelBox.SetBinding(ToolTipProperty, bindlevelprocessstr);

            Binding bindlevelpercentage = new Binding()
            {
                Source    = Account.Instance,
                Path      = new PropertyPath("ExpProgress"),
                Mode      = BindingMode.OneWay,
                Converter = new Percentage_Converter()
            };

            Lbl_Level.SetBinding(TextBlock.TextProperty, bindlevelpercentage);
        }