IQueryAmbient Arabirim
Tanım
Belirtilen bir özelliğin geçerli kapsamda çevresel olarak değerlendirilip değerlendirilmeyeceği sorguları.Queries for whether a specified property should be treated as ambient in the current scope.
public interface class IQueryAmbient
public interface IQueryAmbient
type IQueryAmbient = interface
Public Interface IQueryAmbient
- Türetilmiş
Açıklamalar
Bir çevresel Özellik mekanizmasının amacı, nesnelerin geçici olan ve tipik bir çalışma süresi uygulaması için faydalı olmayan değerler için olduğu bilinen bir durum olduğu durumlarda, bir XAML nesne yazıcısının belirli nesneleri örneklemeyi önlemek için bir XAML nesne yazıcısında, bazı nesnelerin örneğini oluşturma süresini geliştirmelidir.The purpose of an ambient property mechanism is to improve parsing time by informing a XAML object writer to avoid instantiating certain objects, in cases where it is known that the objects are for values that are temporary and not useful for a typical run time application. Normal olarak, bir özellik al erişimcisinin XAML aramaları veya XAML işlemesi, nesne grafiği gösterimini kullanıma hazırlama değerleriyle dolduracak şekilde bu nesneleri örneklemesi gerekir.Normally, XAML lookups or XAML processing of a property get accessor would need to instantiate such objects to fill the object graph representation with ready-to-use values.
IQueryAmbientbir üyeye sahip: IsAmbientPropertyAvailable .IQueryAmbient has one member: IsAmbientPropertyAvailable.
IQueryAmbient, için paralel bir mekanizmadır AmbientAttribute .IQueryAmbient is a parallel mechanism to AmbientAttribute. IQueryAmbient, bilgileri belirlemek için yansıma kullanımını engelleyen ve ayrıca situationally (belirli bir nesne için rapor true
veya için seçim yapabilir false
IsAmbientPropertyAvailable ), ancak öznitelik temelde statik analizler olan özel bir mekanizmadır.IQueryAmbient is the specialized mechanism that avoids using reflection to determine information, and can also act situationally (a given object could choose to report true
or false
for IsAmbientPropertyAvailable), whereas the attribute is essentially static analysis). AmbientAttribute, XAML nesne yazarları tarafından kullanılabilen ve genellikle adanmış XAML türü sistem özellikleriyle ve ile ilişkili olan genel bir mekanizmadır IsAmbient IsAmbient .AmbientAttribute is the general mechanism that can be used by XAML object writers and that typically correlates to the dedicated XAML type system properties IsAmbient and IsAmbient.
Iqueryambun WPF uygulamalarıWPF Implementations of IQueryAmbient
WPF 'de, IQueryAmbient kaynak sözlüğü arama işlemi için kullanılır.In WPF, IQueryAmbient is used for the resource dictionary lookup process. Arama işlemi, Resources
bir anahtar bulunana ya da anahtarın kapsamda mevcut olmadığı belirlenene kadar, kaynak kapsamının köküne doğru çalışarak, WPF mantıksal ağacının tamamında ardışık değerleri alır.The lookup process gets successive Resources
values throughout the WPF logical tree, working towards the root of the resource scope until either a key is found or the key is determined to not exist in scope. Genellikle, bu işlemin ResourceDictionary sonuçları almak için her seferinde bir kez örneğini oluşturma gerekir.Normally, doing so would require instantiating a ResourceDictionary each time to receive the results. İçeriği Resources
ortam olarak bildirmek, Resources
Bu arama işlemini en iyi duruma getirir.Declaring the contents of Resources
as ambient so long as Resources
exists optimizes this lookup process. WPF 'de, bu arabirim aşağıdaki durumlarda uygulanır:In WPF, this interface is implemented in the following cases:
FrameworkElementIQueryAmbient.IsAmbientPropertyAvailable
true
ResourceDictionary , için mevcut bir, varsa Resources ve sorgu özelliğin kendisi için olmadığı sürece tüm özellik adlarına dönmek için uygular Resources .FrameworkElement implements IQueryAmbient.IsAmbientPropertyAvailable to returntrue
for all property names if it contains an existing ResourceDictionary for Resources, and so long as the query is not for the Resources property itself.Style, için aynı kalıbı uygular Resources .Style implements the same pattern for its Resources.
Application, için aynı kalıbı uygular Resources .Application implements the same pattern for its Resources.
FrameworkContentElement, için aynı kalıbı uygular Resources .FrameworkContentElement implements the same pattern for its Resources.
FrameworkTemplate, için aynı kalıbı uygular Resources .FrameworkTemplate implements the same pattern for its Resources. Ayrıca Template içeriği çevresel olarak raporlar
false
, ancak kendisi için sorgulama yaptıysanız döndürür Template .It also reports Template content as ambient but returnsfalse
if querying for Template itself.Bu durumların her birinde, ilgili
Resources
Özellik (ve), Template olarak atanır AmbientAttribute .In each of these cases, the relevantResources
property (and Template) are attributed as AmbientAttribute. Tipik kullanım, AmbientAttribute arabirimini tanımlayan nesnenin öznitelikli özellikleri olmayan özellikleri sorgulamadır.The typical usage is to query for the properties that are NOT the AmbientAttribute attributed properties of the object that defines the interface. Diğer bir deyişle, nesne grafiği oluşturulduğunda olası çalışma süresi değerini sağlamak için bir kaynak sözlüğü olduğu sürece, kaynak sözlüğü Özellik kapsayıcısının yanı sıra diğer tüm özellikler çevresel olarak kabul edilebilir.In other words, so long as a resource dictionary exists in order to provide the potential run time value when the object graph is created, any other property besides the resource dictionary's property container can be treated as ambient.
Yöntemler
IsAmbientPropertyAvailable(String) |
Belirtilen adlandırılmış bir özelliğin geçerli kapsamda ortam olarak kabul edilip edilmeyeceğini sorgular.Queries for whether a specified named property can be considered ambient in the current scope. |