コード例 #1
0
        public void Override_ContentProperty_to_RichTextBox()
        {
            var field = new XceedRichTextField(new FieldDefinition {
                Key = "key"
            }, ServiceLocator);

            field.ContentProperty.Should().Be(RichTextBox.TextProperty);

            var textBox = (RichTextBox)field.ValueControl;

            field.GetValue().Should().BeNullOrEmpty();
            textBox.Text.Should().BeNullOrEmpty();

            field.SetValue("foobar");
            textBox.Text.Should().Contain(field.GetValue());

            textBox.Text = "not foobar";
            textBox.Text.Should().Contain(field.GetValue());
        }
コード例 #2
0
        public void Toggle_CallSigns_on_KeyGesture()
        {
            INZazuWpfField gistField = new XceedRichTextField(new FieldDefinition {
                Key = "myGist"
            }, ServiceLocator);

            gistField.GetValue().Should().BeNullOrWhiteSpace();

            var routedEvent = Keyboard.KeyUpEvent;
            var source      = Substitute.For <PresentationSource>();
            var keyGesture  = new KeyGesture(Key.Home);
            var key         = keyGesture.Key;
            var device      = Keyboard.PrimaryDevice;
            var eventArgs   = new KeyEventArgs(device, source, 0, key)
            {
                RoutedEvent = routedEvent
            };

            var textBox = (RichTextBox)gistField.ValueControl;

            textBox.RaiseEvent(eventArgs);
            gistField.GetValue().Should().BeNullOrWhiteSpace("neither from or to has value that could be toggled");
        }