我如何在XAML中使用类 [英] How i can Use class in xaml
问题描述
大家好.
我在Google中搜索如何绑定扩展器texblock,发现这篇文章http://stackoverflow.com/questions/3388138/wpf-datagrid-group-expander-text-how-to-bind,这是我正在寻找的...但是问题是我不知道该如何使用:< local:GroupingName x:Key =" GroupingName"/>我必须将其放在我的xaml中的位置
我知道这是一个非常愚蠢的问题,但我在WPF中是新的. :)
任何建议对m
Hello guys.
i was searching in google how to bind expander texblock found this article http://stackoverflow.com/questions/3388138/wpf-datagrid-group-expander-text-how-to-bind it is what i was looking for... but problem is that i dont know how i can use this : <local:GroupingName x:Key="GroupingName"/> where i must place this in my xaml
i know this is very stupid question but im new in wpf. :)
any advice would be ver helpful for m
推荐答案
都是有帮助的.您需要将其放在< Window.Resources>中.这也假定您已经在窗口中创建了一个名为local的命名空间,该命名空间引用了保存您的类的命名空间.这样的东西
You need to place this in <Window.Resources>. This also assumes you have created a namespace called local in your window that refers to the namespace that holds your class . Something like this
<Window x:Class="yourClass.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300"
xmlns:local="clr-namespace:Models;assembly=Models" >
<Window.Resources>
<local:GroupingName x:Key="GroupingName"/>
</Window.Resources>
<Grid>
</Grid>
</Window>
希望这会有所帮助
顺便说一下
Hope this helps
By the way
这是一个非常愚蠢的问题
this is very stupid question
没有愚蠢的问题.只有愚蠢的答案.宁可问一下:)
There is no such thing as a stupid question. Only stupid answers. Rather just ask :)
GroupingName
似乎是一个类,所以它可以在应用程序中的任何地方.
local
表示一个名称空间,并将在xaml的顶部定义.
GroupingName
appears to be a class, so it can be anywhere in the application.
local
represents a namespace and will be defined at the top of the xaml.
这篇关于我如何在XAML中使用类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!