首页 \ 问答 \ “属性”没有定义?(“properties” is not defined?)

“属性”没有定义?(“properties” is not defined?)

我试图在用户设置上遵循本教程:

http://blogs.msdn.com/b/patrickdanino/archive/2008/07/23/user-settings-in-wpf.aspx

我定义了一个名称为Selected的设置,类型为int,scope user。 在App.xaml中,我有:

<Application.Resources>
        <properties:Selected x:Key="Selected"/>
    </Application.Resources>

但是我收到此错误消息:

“名称空间前缀”属性“未定义”

我无法弄清楚为什么......欢迎任何建议。

PS。 如果你能看看我的另一个问题,那就太好了! :)

找不到绑定源

编辑:解决了!


I was trying to follow this tutorial on user settings:

http://blogs.msdn.com/b/patrickdanino/archive/2008/07/23/user-settings-in-wpf.aspx

I defined a setting whose name was Selected, type int, scope user. In App.xaml, I had:

<Application.Resources>
        <properties:Selected x:Key="Selected"/>
    </Application.Resources>

However I got this error message:

"The namespace prefix "properties" is not defined"

I couldn't figure out why...Any suggestions are welcome.

PS. If you could take a look at another question of mine, it would be great! :)

Cannot find source for binding

Edit: Solved!


原文:https://stackoverflow.com/questions/14432692
更新时间:2023-02-12 19:02

最满意答案

这个答案可能无法解决您的具体问题,但它可能会帮助其他类似场景(在大多数情况下使用表格很难呈现干净的布局。)

我之前遇到过这个问题,这就是我解决它的方法。 它基本上依赖于html嵌套的div结构来实现内容的可扩展性,而不会影响near元素的浮动布局:

<div id="wrapper" class="cf"><!--wrapper with border and CLEARED-->

    <div class="sccontainer"><!--position relative-->
        <div class="inner"><!--position absolute-->
            <div class="content"><!--position relative-->
                <!-- my content here -->
            </div>
        </div> 
    </div>
    <!-- more containers etc-->

</div><!--END wrapper-->

首先,我们将把臭名昭着的clear-fix hack应用于#wrapper容器(使用您首选的方法):

.cf:after {
    visibility:hidden;
    display:block;
    content:"";
    clear:both;
    height:0
}
* html .cf {
    zoom:1
}
/* IE6 */
 *:first-child+html .cf {
    zoom:1
}

然后是.sccontainer容器的样式:

.sccontainer {
    width: 280px; /* or whatever - could be % for responsiveness */
    padding-bottom:200px; /* any value to give height without using height ;) */
    position: relative;
    float: left;
    margin: 5px 10px; /* or whatever */
    overflow: hidden; /* this is important to keep all same height and big content out of sight */
    z-index: 1; /* this is important too, see later */
    background: white url("imagebackground.jpg") 0 0 repeat-x; /* need to explain? */
}

然后是.inner容器,如果我们hover元素,它实际上将有助于保持布局顺序

.inner {
    position: absolute; /* please don't move */
    width: 100%; /* to fill the whole parent container */
    height: 100%; /* same */
}

内容:

.content {
    position: relative;
    background: white url("imagebackground.jpg") 0 0 repeat-x; /* not redundant though */
    width: 100%; /* helps to fill the gaps with small content */
    height: 100%; /* same, specially if using image backgrounds */
    /* other styles, etc */
}

注意 :我们应该将相同的border-radius属性应用于三个容器,并将box-shadow应用于.sccontainer.content以保持一致性

现在,当我们hover时会发生什么?

.sccontainer:hover {
    overflow: visible; /* show the full content */
    z-index: 999; /* place me on top of the others if needed (which lower z-index, remember?) */
}

.sccontainer:hover .content {
    height: auto; /* as it really is, including background image */
}

注意 :无论内容的height是否小于父容器的height都会发生这种效果。 你可能不喜欢这种效果,如果你使用边框和阴影(可以在父容器中显示为较小的框),所以我们可以添加一个额外的类到.sccontainer

<div class="sccontainer withhover">

并且仅当该类存在时才应用hover效果

.sccontainer.withhover:hover {
    overflow: visible;
    z-index: 999;
}

...并使用一些jQuery删除该类以获取更短的内容,因此不会受到影响:

jQuery(document).ready(function ($) {
    $(".sccontainer").hover(function () {
        var $contentHeight = $(this).find(".content").height();
        if ($(this).innerHeight() > $contentHeight) {
            $(this).removeClass("withhover");
        }
    });
});

请参阅JSFIDDLE


This answer may not solve your specific problem but it may help others with a similar scenario (working with tables makes difficult to render a clean layout in most cases.)

I ran into this issue before and this is how I solved it. It basically relies in an html nested div structure to achieve the expandability of the content without affecting the floating layout of the near elements :

<div id="wrapper" class="cf"><!--wrapper with border and CLEARED-->

    <div class="sccontainer"><!--position relative-->
        <div class="inner"><!--position absolute-->
            <div class="content"><!--position relative-->
                <!-- my content here -->
            </div>
        </div> 
    </div>
    <!-- more containers etc-->

</div><!--END wrapper-->

First, we are going to apply the infamous clear-fix hack to the #wrapper container (use your preferred method):

.cf:after {
    visibility:hidden;
    display:block;
    content:"";
    clear:both;
    height:0
}
* html .cf {
    zoom:1
}
/* IE6 */
 *:first-child+html .cf {
    zoom:1
}

Then the style for the .sccontainer container :

.sccontainer {
    width: 280px; /* or whatever - could be % for responsiveness */
    padding-bottom:200px; /* any value to give height without using height ;) */
    position: relative;
    float: left;
    margin: 5px 10px; /* or whatever */
    overflow: hidden; /* this is important to keep all same height and big content out of sight */
    z-index: 1; /* this is important too, see later */
    background: white url("imagebackground.jpg") 0 0 repeat-x; /* need to explain? */
}

Then the .inner container, which actually will help to keep the layout in order if we hover the elements

.inner {
    position: absolute; /* please don't move */
    width: 100%; /* to fill the whole parent container */
    height: 100%; /* same */
}

And the content :

.content {
    position: relative;
    background: white url("imagebackground.jpg") 0 0 repeat-x; /* not redundant though */
    width: 100%; /* helps to fill the gaps with small content */
    height: 100%; /* same, specially if using image backgrounds */
    /* other styles, etc */
}

NOTE: we should apply same border-radius properties to the three containers and box-shadow to .sccontainer and .content for consistency

Now, what happens when we hover ?

.sccontainer:hover {
    overflow: visible; /* show the full content */
    z-index: 999; /* place me on top of the others if needed (which lower z-index, remember?) */
}

.sccontainer:hover .content {
    height: auto; /* as it really is, including background image */
}

NOTES : this effect will happen regardless if the content's height is smaller than the parent container's height. You may not like the effect mostly if you are using borders and shadows (could be shown as smaller box inside the parent container) so we could add an extra class to .sccontainer like

<div class="sccontainer withhover">

and apply the hover effects only if that class exist like

.sccontainer.withhover:hover {
    overflow: visible;
    z-index: 999;
}

... and use a bit of jQuery to remove that class for shorter content, so it won't be affected :

jQuery(document).ready(function ($) {
    $(".sccontainer").hover(function () {
        var $contentHeight = $(this).find(".content").height();
        if ($(this).innerHeight() > $contentHeight) {
            $(this).removeClass("withhover");
        }
    });
});

See JSFIDDLE

相关问答

更多
  • 正如您所说,您的主要问题是使正确的列与页面一样高,即向下扩展到主要内容。 这可以通过添加到CSS来解决: #columnrt { width:200px; background-color:#673601; position:absolute; top: 0; right:0; bottom:0; } 这将使右列的高度正确延伸,允许您添加渐变。 As you say, your main problem is making the right column as tall as the page, i.e ...
  • 这个答案可能无法解决您的具体问题,但它可能会帮助其他类似场景(在大多数情况下使用表格很难呈现干净的布局。) 我之前遇到过这个问题,这就是我解决它的方法。 它基本上依赖于html嵌套的div结构来实现内容的可扩展性,而不会影响near元素的浮动布局:
    ...
  • 我不知道为什么,但是当我今天早上开始测试时,显示了CSS背景。 我没有对CSS或AbsolutePanel进行任何更改。 将来如果我遇到CSS问题,我会先重新启动。 问候, 格林 I do not know why, however when I started testing this morning the CSS background was displayed. I have not made any changes to the CSS or the AbsolutePanel. In futur ...
  • 尝试: background-position: center center; ===== 更新: 与小提琴一起工作会更轻松! 尝试这个: div.VISA_logo { background: url("http://www.globalworkandtravel.com/sites/all/modules/customshare/includes/facebook.png") no-repeat; } div.VISA_CARTE_BLEUE_logo{ background: ur ...
  • 如果你看一下图像的属性,那么源是外部的吗? 如果是,那么您打开电子邮件的网址是否有效(并且可访问)? if you look at the properties of the image, is the source external? if yes, is the url is valid (and accessible) from where you open the email?
  • 您可以对第一个元素应用负margin-bottom 。 .background-pic { background-image: url(https://www.placecage.com/600/400); height: 400px; background-position: center; background-repeat: no-repeat; background-size: cover; margin-bottom: -100px; } .conten ...
  • 如果box_dx1 , box_dx3和image-box的高度始终相同,则可以为box_dx2设置min-height 。 这样,如果你向box_dx2添加更多内容,它最终将变得比图像更高,文本将环绕它。 在您的示例中,它将类似于: #box_dx2 { width: 500px; padding-top:10px; background:#999; min-height: 70px; } 的jsfiddle 但是,如果这些盒子的高度不固定,可能最简单的方法是使 ...
  • 刚检查了您网站上的错误。 您必须将样式应用于.social的子div .social div { display: inline-block; margin-right: 15px; display: inline; // remove this line zoom: 1; } 去除 "display: inline" 就收下吧 .social div { display: inline-block; margin-right: 15px; ...
  • flexbox的技术是添加flex-grow: 1; 到您想要具有动态高度的元素。 这是一个简单的例子。 * {margin:0;padding:0;box-sizing:border-box;} html,body,.flex { min-height: 100vh; } .flex { display: flex; flex-direction: column; } .a { flex-grow: 1; background: #eee; } .b { ...
  • 嗯,实际上它取决于你的真实标记,但这可能是一个起点: 关键点在于顶部/底部padding的百分比值是相对于包含框的width 。 此外,使用background-size: contain contains调整背景图像的宽高比。 值得注意的是IE9 +支持此功能。 有关响应式容器的进一步阅读,请参阅我的答案。 这里的例子 。 .box { background: url(http://placehold.it/300) 50% 50% / contain no-repeat; width ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。