当前位置: 首页>>代码示例>>C#>>正文


C# Selector.Match方法代码示例

本文整理汇总了C#中Selector.Match方法的典型用法代码示例。如果您正苦于以下问题:C# Selector.Match方法的具体用法?C# Selector.Match怎么用?C# Selector.Match使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Selector的用法示例。


在下文中一共展示了Selector.Match方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Name_Doesnt_Match_Control_With_TemplatedParent

        public void Name_Doesnt_Match_Control_With_TemplatedParent()
        {
            var control = new Control1 { TemplatedParent = new Mock<ITemplatedControl>().Object };
            var target = new Selector().Name("foo");
            var activator = target.Match(control);

            Assert.False(target.Match(control).ImmediateResult);
        }
开发者ID:Arlorean,项目名称:Perspex,代码行数:8,代码来源:SelectorTests_Name.cs

示例2: OfType_Matches_Control_With_TemplatedParent

        public void OfType_Matches_Control_With_TemplatedParent()
        {
            var control = new Control1 { TemplatedParent = new Mock<ITemplatedControl>().Object };
            var target = new Selector().OfType<Control1>();

            Assert.True(target.Match(control).ImmediateResult);
        }
开发者ID:Arlorean,项目名称:Perspex,代码行数:7,代码来源:SelectorTests_OfType.cs

示例3: OfType_Doesnt_Match_Control_Of_Wrong_Type

        public void OfType_Doesnt_Match_Control_Of_Wrong_Type()
        {
            var control = new Control2();
            var target = new Selector().OfType<Control1>();

            Assert.False(target.Match(control).ImmediateResult);
        }
开发者ID:Arlorean,项目名称:Perspex,代码行数:7,代码来源:SelectorTests_OfType.cs

示例4: OfType_Matches_Control_Of_Correct_Type

        public void OfType_Matches_Control_Of_Correct_Type()
        {
            var control = new Control1();
            var target = new Selector().OfType<Control1>();

            Assert.True(target.Match(control).ImmediateResult);
        }
开发者ID:Arlorean,项目名称:Perspex,代码行数:7,代码来源:SelectorTests_OfType.cs

示例5: Name_Doesnt_Match_Control_Of_Wrong_Name

        public void Name_Doesnt_Match_Control_Of_Wrong_Name()
        {
            var control = new Control1 { Name = "foo" };
            var target = new Selector().Name("bar");

            Assert.False(target.Match(control).ImmediateResult);
        }
开发者ID:Arlorean,项目名称:Perspex,代码行数:7,代码来源:SelectorTests_Name.cs

示例6: Name_Matches_Control_With_Correct_Name

        public void Name_Matches_Control_With_Correct_Name()
        {
            var control = new Control1 { Name = "foo" };
            var target = new Selector().Name("foo");

            Assert.True(target.Match(control).ImmediateResult);
        }
开发者ID:Arlorean,项目名称:Perspex,代码行数:7,代码来源:SelectorTests_Name.cs

示例7: PropertyEquals_Matches_When_Property_Has_Matching_Value

        public async Task PropertyEquals_Matches_When_Property_Has_Matching_Value()
        {
            var control = new TextBlock();
            var target = new Selector().PropertyEquals(TextBlock.TextProperty, "foo");
            var activator = target.Match(control).ObservableResult;

            Assert.False(await activator.Take(1));
            control.Text = "foo";
            Assert.True(await activator.Take(1));
            control.Text = null;
            Assert.False(await activator.Take(1));
        }
开发者ID:Arlorean,项目名称:Perspex,代码行数:12,代码来源:SelectorTests_PropertyEquals.cs

示例8: Template_Child_Of_Control_With_Two_Classes

        public void Template_Child_Of_Control_With_Two_Classes()
        {
            var template = new FuncControlTemplate(parent =>
            {
                return new Border
                {
                    Name = "border",
                };
            });

            var control = new Button
            {
                Template = template,
            };

            control.ApplyTemplate();

            var selector = new Selector()
                .OfType<Button>()
                .Class("foo")
                .Class("bar")
                .Template()
                .Name("border");

            var border = (Border)((IVisual)control).VisualChildren.Single();
            var values = new List<bool>();
            var activator = selector.Match(border).ObservableResult;

            activator.Subscribe(x => values.Add(x));

            Assert.Equal(new[] { false }, values);
            control.Classes.AddRange(new[] { "foo", "bar" });
            Assert.Equal(new[] { false, true }, values);
            control.Classes.Remove("foo");
            Assert.Equal(new[] { false, true, false }, values);
        }
开发者ID:Arlorean,项目名称:Perspex,代码行数:36,代码来源:SelectorTests_Multiple.cs


注:本文中的Selector.Match方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。