小编Har*_*ngh的帖子

在WPF中处理MVVM中的鼠标事件

我在MVF中使用MVVM.我在某种程度上停了下来,我希望你对此有所了解.我正在使用MouseBehaviour.cs类触发鼠标事件,有没有其他方法来处理MVVM WPF中的鼠标事件

using System.Windows;
using System.Windows.Input;

namespace Lovatts.MouseBehaviours
{
    public class MouseBehaviour
    {
        #region MouseUp

        public static readonly DependencyProperty MouseUpCommandProperty =
            DependencyProperty.RegisterAttached("MouseUpCommand", typeof(ICommand), typeof(MouseBehaviour), new FrameworkPropertyMetadata(new PropertyChangedCallback(MouseUpCommandChanged)));

        private static void MouseUpCommandChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            FrameworkElement element = (FrameworkElement)d;

            element.MouseUp += element_MouseUp;
        }

        static void element_MouseUp(object sender, MouseButtonEventArgs e)
        {
            FrameworkElement element = (FrameworkElement)sender;

            ICommand command = GetMouseUpCommand(element);

            command.Execute(e);
        }



        public static void SetMouseUpCommand(UIElement element, ICommand value)
        {
            element.SetValue(MouseUpCommandProperty, value);
        }

        public static ICommand GetMouseUpCommand(UIElement element)
        {
            return (ICommand)element.GetValue(MouseUpCommandProperty);
        } …
Run Code Online (Sandbox Code Playgroud)

wpf mvvm mouseevent mvvm-light

8
推荐指数
2
解决办法
2万
查看次数

MTOUCH:错误MT0024:找不到所需文件iPhoneSimulator9.0.sdk"/SDKSettings.plist

我用xcode7为IOS9升级了我的xamarin.更新后,我遇到了很多问题.请检查以下错误:

MTOUCH:错误MT0024:找不到所需的文件'"/Applications/Xcode7.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.0.sdk"/SDKSettings.plist'.(MT0024)

我们将非常感谢您的帮助.

xamarin.ios xamarin xamarin-studio xcode7

5
推荐指数
1
解决办法
651
查看次数

将文本调整为矩形 在 Canvas HTML5 中调整大小

我是 Canvas 的新手,我正在创建一个网站以在我重新调整矩形大小时增加文本。我尝试了很多,但没有任何效果对我有用。实际上,我希望如果我仅通过其宽度(向左/向右拉伸)调整矩形的大小,则只应增加文本宽度而不是字体大小。我已经完成了 fontsize 但发现增加孤立文本高度和宽度的困难。非常欢迎您的建议

在此处输入图片说明

function Box2() {
        this.x = 0;
        this.y = 0;
        this.w = 1; // default width and height?
        this.h = 1;
        this.fill = '#CC0000';
        this.Owntext = "";
        this.fontsize = '20';
        this.TextColor = '';
        this.TextFontFamily = '';
        this.Angle = 0;
        this.ScaleHeight = 1;
        this.ScaleWidth = 1;
    }

    // New methods on the Box class
    Box2.prototype = {
        // we used to have a solo draw function
        // but now each box is responsible for its own drawing …
Run Code Online (Sandbox Code Playgroud)

html javascript canvas html5-canvas

3
推荐指数
1
解决办法
3722
查看次数