WPF开发人员要避免的常见编程错误?(Common Programming mistakes for WPF developers to avoid? [closed])
WPF开发人员可以避免哪些常见错误?
what are the common mistake can be avoided by a WPF developer?
原文:https://stackoverflow.com/questions/3012751
最满意答案
我知道这已经得到了回答,但是这里有一个替代方案,它不会在两个元素之间使用任何层次结构(尽管这可能不是最佳实践):
HTML:
<div class="boss"></div> <div class="employee"></div> <div class="boss"></div> <div class="employee"></div>
JS:
$.fn.invisible = function() { return this.css("visibility", "hidden"); }; $.fn.visible = function() { return this.css("visibility", "visible"); }; $(".boss").draggable({ stop:function(e) { var employee_horizontal_position= $(this).offset().left+$(this).width(); var employee_vertical_position= $(this).offset().top-$(this).height(); $(this).next().visible(); $(this).next().offset({top: employee_vertical_position, left: employee_horizontal_position}); } }); $(".boss").on("drag", function(e){ $(this).next().invisible(); });
CSS:
.boss{ height: 100px; width: 300px; background-color: grey; float:left; margin-top:100px; } .boss:hover{ cursor:pointer; } .employee{ height: 300px; width: 100px; background-color: orange; float:left; }
JSFIDDLE示例: http : //jsfiddle.net/ktxo4f6s/2/
当屏幕录像中显示的老板被拖动时,我试图让员工隐藏起来。
I know this has been answered already, but here is an alternative which does not use any hierarchy between the two elements (even though that might not be the best practice):
HTML:
<div class="boss"></div> <div class="employee"></div> <div class="boss"></div> <div class="employee"></div>
JS:
$.fn.invisible = function() { return this.css("visibility", "hidden"); }; $.fn.visible = function() { return this.css("visibility", "visible"); }; $(".boss").draggable({ stop:function(e) { var employee_horizontal_position= $(this).offset().left+$(this).width(); var employee_vertical_position= $(this).offset().top-$(this).height(); $(this).next().visible(); $(this).next().offset({top: employee_vertical_position, left: employee_horizontal_position}); } }); $(".boss").on("drag", function(e){ $(this).next().invisible(); });
CSS:
.boss{ height: 100px; width: 300px; background-color: grey; float:left; margin-top:100px; } .boss:hover{ cursor:pointer; } .employee{ height: 300px; width: 100px; background-color: orange; float:left; }
JSFIDDLE EXAMPLE: http://jsfiddle.net/ktxo4f6s/2/
I tried to make the employee hidden while the boss is being dragged as shown in your screencast.
相关问答
更多-
不相关的指针的平等比较能评估为真吗? 是的, 但是... int a; int b; printf("a precedes b: %d\n", (&a + 1) == &b); printf("b precedes a: %d\n", (&b + 1) == &a); 根据我对C标准的解释,有三种可能性: a紧接在b之前 b立即在a之前 a和b都不会立即在另一个之前(它们之间可能有间隙或另一个对象) 我前段时间玩过这个游戏,并得出结论说GCC对指针的==运算符执行无效优化,即使地址相同,也会产生错误,所以 ...
-
问题 你有错误的课程。 它disappear而不是disappear 使用$("li.one")代替$( "li one" )和$("li.two")代替$( "li two" ) 使用index()而不是eq() 我推荐使用.hover() 码 $("li.one").hover(function () { var indx = $(this).index(); $("li.two").eq(indx).addClass("disappear"); }, function () { ...
-
合并两个不相关的表(Combine Two Unrelated Tables)[2022-06-01]
根据您的评论,您正在尝试根据访问当天开具的药物加入药物治疗。 在这种情况下,您需要加入该信息: SELECT [tblVisits].[VisitNumber], [tblVisits].[Date], ..., [tblVisits].[Comments], [tblMedications].[DatePrescribed], ..., [tblMedications].[Expires], [tblMedications].[Lot] FROM [tblVisits] JOIN [tblM ... -
A和B是不同的类型。 如果你想要一个可以接受多种类型值的函数,你需要一个类型类。 data A = A data B = B class F a where f :: a -> Int instance F A where f _ = 1 instance F B where f _ = 2 main = do print $ f A A and B are distinct types. If you want a function that can take values of ...
-
您的第二个选择器#table-b td, tr, th {...]选择文档中的所有td,tr和ths。 你必须在每个表格前添加表格选择器: #table-b td, #table-b tr, #table-b th {...] 另外还要在其他选择器中添加#table-a 。 Your second selector #table-b td, tr, th {...] selects ALL of the td, tr and ths within the document. You have to p ...
-
因为root是未初始化的,所以它应该为null(可能)。 所以你得到了未定义的行为。 main也应该返回一个值(只是因为c允许你省略'int'来编译)。 您的代码将告诉客户端退出时出现不可预测的错误。 Because root is uninitialised, it should be null (probably). So you're getting undefined behaviour. Also main should return a value (only because c allows ...
-
我知道这已经得到了回答,但是这里有一个替代方案,它不会在两个元素之间使用任何层次结构(尽管这可能不是最佳实践): HTML: JS: $.fn.invisible = function() { return this.css("visibility", "hidden"); }; $ ...
-
CSS:使用element选择不相关的元素:hover pseudoclass(CSS: Selecting unrelated element using element:hover pseudoclass)[2022-04-13]
是的,但不是CSS。 使用JavaScript。 这是一个jQuery示例。 $('#bar').hover( function(e) { $foo = $('#foo'); $foo.data('prevColor', $foo.css('color')); $foo.css('color', 'green'); }, function(e) { $foo = $('#foo'); $foo.css('color', $foo.data('prevCol ... -
这当然是可能的。 涉及两个步骤: 1)将悬停效果放在容器上,这样只要将鼠标悬停在容器中的任何位置 - area1和area2都会获得新的背景 .container:hover .area1,.container:hover .area2 { background-color: green; } 这里的问题是,现在悬停效果将在容器中的任何位置生效,而不仅仅是当我将鼠标悬停在2个区域上时。 所以.... 2)诀窍是关闭容器上的指针事件并在2个区域上重新打开它们。 因此,当鼠标悬停在2个区域之外的容器中的 ...
-
事实上,您正在寻找的是一个可以将行星映射到兼容物种集合的查找。 如果您使用如下所示的“映射”类,那么这很容易实现(这只是因为Java没有任何类型感知,类似于Tuple的数据结构): public static class PlanetSpecies { Planet planet; Set
species; public PlanetSpecies(Planet planet, Set species) { this.planet ...