ResourceDictionary.Source Egenskap

Definition

Hämtar eller anger den enhetliga resursidentifieraren (URI) som ska läsas in resurser från.

public:
 property Uri ^ Source { Uri ^ get(); void set(Uri ^ value); };
public Uri Source { get; set; }
member this.Source : Uri with get, set
Public Property Source As Uri

Egenskapsvärde

Uri

Källplatsen för en extern resursordlista.

Exempel

I följande exempel anges två ResourceDictionary element som ska sammanfogas till den primära ResourceDictionary.

<Page.Resources>
  <ResourceDictionary>
    <ResourceDictionary.MergedDictionaries>
      <ResourceDictionary Source="myresourcedictionary.xaml"/>
      <ResourceDictionary Source="myresourcedictionary2.xaml"/>
    </ResourceDictionary.MergedDictionaries>
  </ResourceDictionary>
</Page.Resources>

Kommentarer

Source Vanligtvis anges som en pack-URI, som refererar till platsen för en resursordlista som ingår som en icke-kompatibel resurs- eller innehållsskapandeåtgärd av ditt programbyggprojekt. Mer information om URI-formatet för paket finns i Pack-URI:er i WPF.

Source I allmänhet anges egenskapen endast för en ResourceDictionary som har angetts för MergedDictionaries egenskapen (antingen som ett egenskapselement i XAML eller som ett ResourceDictionary objekt i samlingen i koden). I den här kontexten sammanfogar inställningen värdet för Source ordlisteinnehållet som finns på den angivna URI:n till den aktuella ResourceDictionary. Eventuella belastningsfel orsakar ett undantagsfel.

Gäller för

Se även