diff options
Diffstat (limited to 'Xamarin.PropertyEditing.Windows')
-rw-r--r-- | Xamarin.PropertyEditing.Windows/PropertyEditorPanel.cs | 26 | ||||
-rw-r--r-- | Xamarin.PropertyEditing.Windows/Themes/PropertyEditorPanelStyle.xaml | 4 |
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}" /> |