mirror of
https://github.com/Stone-Red-Code/docs-desktop.git
synced 2026-09-04 09:06:04 +02:00
Merge branch 'master' into publish-30962
This commit is contained in:
+2
-2
@@ -88,7 +88,7 @@ End Sub
|
|||||||
```csharp
|
```csharp
|
||||||
private ImageCodecInfo GetEncoder(ImageFormat format)
|
private ImageCodecInfo GetEncoder(ImageFormat format)
|
||||||
{
|
{
|
||||||
ImageCodecInfo[] codecs = ImageCodecInfo.GetImageDecoders();
|
ImageCodecInfo[] codecs = ImageCodecInfo.GetImageEncoders();
|
||||||
foreach (ImageCodecInfo codec in codecs)
|
foreach (ImageCodecInfo codec in codecs)
|
||||||
{
|
{
|
||||||
if (codec.FormatID == format.Guid)
|
if (codec.FormatID == format.Guid)
|
||||||
@@ -103,7 +103,7 @@ private ImageCodecInfo GetEncoder(ImageFormat format)
|
|||||||
```vb
|
```vb
|
||||||
Private Function GetEncoder(ByVal format As ImageFormat) As ImageCodecInfo
|
Private Function GetEncoder(ByVal format As ImageFormat) As ImageCodecInfo
|
||||||
|
|
||||||
Dim codecs As ImageCodecInfo() = ImageCodecInfo.GetImageDecoders()
|
Dim codecs As ImageCodecInfo() = ImageCodecInfo.GetImageEncoders()
|
||||||
Dim codec As ImageCodecInfo
|
Dim codec As ImageCodecInfo
|
||||||
For Each codec In codecs
|
For Each codec In codecs
|
||||||
If codec.FormatID = format.Guid Then
|
If codec.FormatID = format.Guid Then
|
||||||
|
|||||||
+3
-1
@@ -37,7 +37,9 @@ This example shows how to define and use an application-scope custom resource di
|
|||||||
[!code-vb[HOWTOResourceDictionaries#3](~/samples/snippets/visualbasic/VS_Snippets_Wpf/HowToResourceDictionaries/VB/MainWindow.xaml.vb#3)]
|
[!code-vb[HOWTOResourceDictionaries#3](~/samples/snippets/visualbasic/VS_Snippets_Wpf/HowToResourceDictionaries/VB/MainWindow.xaml.vb#3)]
|
||||||
|
|
||||||
There are two considerations to make when using <xref:System.Windows.Application.Resources%2A>. First, the dictionary *key* is an object, so you must use exactly the same object instance when both setting and getting a property value. (Note that the key is case-sensitive when using a string.) Second, the dictionary *value* is an object, so you will have to convert the value to the desired type when getting a property value.
|
There are two considerations to make when using <xref:System.Windows.Application.Resources%2A>. First, the dictionary *key* is an object, so you must use exactly the same object instance when both setting and getting a property value. (Note that the key is case-sensitive when using a string.) Second, the dictionary *value* is an object, so you will have to convert the value to the desired type when getting a property value.
|
||||||
|
|
||||||
|
Some resource types may automatically use a property defined by the type as an explicit key, such as the <xref:System.Windows.Style> and <xref:System.Windows.DataTemplate> types. This may override your `x:Key` value. To guarantee that your `x:Key` key is respected, declare it before the explicit key property. For more information, see [Styles, DataTemplates, and implicit keys](../advanced/xaml-resources-define.md#styles-datatemplates-and-implicit-keys).
|
||||||
|
|
||||||
## See also
|
## See also
|
||||||
|
|
||||||
- <xref:System.Windows.ResourceDictionary>
|
- <xref:System.Windows.ResourceDictionary>
|
||||||
|
|||||||
Reference in New Issue
Block a user