Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/xamarin/Xamarin.PropertyEditing.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominique Louis <savagesoftware@gmail.com>2018-08-29 15:58:44 +0300
committerGitHub <noreply@github.com>2018-08-29 15:58:44 +0300
commit738949a696525c3166ef8da269f522b525fdcc19 (patch)
treef38ff62182070ca0d52b8e436a172c6cc61f2a4d /Xamarin.PropertyEditing.Windows
parentfe6fdb7313633078d3721b226763625c8ffddfd5 (diff)
parent8ff08a5cbbf49ec1395df17e47cbf1df7d184d50 (diff)
Merge pull request #371 from xamarin/ermau-type-icon-provider
[Core/Win] Add type icon support
Diffstat (limited to 'Xamarin.PropertyEditing.Windows')
-rw-r--r--Xamarin.PropertyEditing.Windows/PropertyEditorPanel.cs26
-rw-r--r--Xamarin.PropertyEditing.Windows/Themes/PropertyEditorPanelStyle.xaml4
2 files changed, 28 insertions, 2 deletions
diff --git a/Xamarin.PropertyEditing.Windows/PropertyEditorPanel.cs b/Xamarin.PropertyEditing.Windows/PropertyEditorPanel.cs
index 813f644..ee7fb84 100644
--- a/Xamarin.PropertyEditing.Windows/PropertyEditorPanel.cs
+++ b/Xamarin.PropertyEditing.Windows/PropertyEditorPanel.cs
@@ -3,10 +3,12 @@ using System.Collections;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
+using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
+using System.Windows.Media.Imaging;
using Xamarin.PropertyEditing.ViewModels;
namespace Xamarin.PropertyEditing.Windows
@@ -82,6 +84,7 @@ namespace Xamarin.PropertyEditing.Windows
base.OnApplyTemplate ();
this.root = (FrameworkElement) GetTemplateChild ("root");
+ this.typeIcon = (Image) GetTemplateChild ("typeIcon");
this.items = (ItemsControl) GetTemplateChild ("propertyItems");
this.propertiesPane = (FrameworkElement) GetTemplateChild ("propertiesPane");
this.eventsPane = (FrameworkElement) GetTemplateChild ("eventsPane");
@@ -99,6 +102,7 @@ namespace Xamarin.PropertyEditing.Windows
private ItemsControl items;
private ChoiceControl paneSelector;
private FrameworkElement propertiesPane, eventsPane;
+ private Image typeIcon;
private void OnPaneChanged (object sender, EventArgs e)
{
@@ -142,6 +146,28 @@ namespace Xamarin.PropertyEditing.Windows
if (ArrangeMode == PropertyArrangeMode.Name)
OnArrangeModeChanged (ArrangeMode);
+
+ UpdateIcon ();
+ }
+
+ private async void UpdateIcon ()
+ {
+ if (this.typeIcon == null)
+ return;
+
+ Stream icon = await this.vm.GetIconAsync ();
+ if (icon == null) {
+ this.typeIcon.Source = null;
+ this.typeIcon.Visibility = Visibility.Collapsed;
+ } else {
+ var source = new BitmapImage();
+ source.BeginInit();
+ source.StreamSource = icon;
+ source.EndInit();
+
+ this.typeIcon.Source = source;
+ this.typeIcon.Visibility = Visibility.Visible;
+ }
}
private void OnTargetPlatformChanged ()
diff --git a/Xamarin.PropertyEditing.Windows/Themes/PropertyEditorPanelStyle.xaml b/Xamarin.PropertyEditing.Windows/Themes/PropertyEditorPanelStyle.xaml
index 3fe3c53..29f7db0 100644
--- a/Xamarin.PropertyEditing.Windows/Themes/PropertyEditorPanelStyle.xaml
+++ b/Xamarin.PropertyEditing.Windows/Themes/PropertyEditorPanelStyle.xaml
@@ -112,8 +112,8 @@
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
- <Border Visibility="Collapsed" Grid.Row="0" Grid.RowSpan="2" Grid.Column="0" Height="32" Width="32" Margin="1,6,5,2" Background="{DynamicResource PropertiesPanelIconBackgroundBrush}" VerticalAlignment="Center">
- <!-- type icon -->
+ <Border Grid.Row="0" Grid.RowSpan="2" Grid.Column="0" Margin="1,6,5,2" Background="{DynamicResource PropertiesPanelIconBackgroundBrush}" VerticalAlignment="Center">
+ <Image Name="typeIcon" Height="32" Width="32" Visibility="Collapsed" />
</Border>
<TextBlock Visibility="{Binding IsObjectNameable, Converter={StaticResource BoolToVisibilityConverter}}" Name="nameLabel" Grid.Row="0" Grid.Column="1" Margin="0,2,0,2" Text="{x:Static prop:Resources.Name}" />