public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            ResourceValueModel resourceValueModel = value as ResourceValueModel;

            if (resourceValueModel != null)
            {
                return((object)resourceValueModel.Resource);
            }
            return((object)null);
        }
Example #2
0
        internal ResourceValueModel GetResourceValueModel(ResourceEntryItem item)
        {
            ResourceValueModel resourceValueModel = (ResourceValueModel)null;

            if (!this.valueModels.TryGetValue((ResourceItem)item, out resourceValueModel) && item.Container.DocumentNode != null)
            {
                resourceValueModel = new ResourceValueModel(item, this.designerContext);
                this.valueModels[(ResourceItem)item] = resourceValueModel;
            }
            return(resourceValueModel);
        }
Example #3
0
        private static void OnResourceValueModelChanged(object sender, DependencyPropertyChangedEventArgs args)
        {
            ResourceValueHost  resourceValueHost  = sender as ResourceValueHost;
            ResourceValueModel resourceValueModel = args.NewValue as ResourceValueModel;

            if (resourceValueHost == null || resourceValueModel == null)
            {
                return;
            }
            resourceValueHost.CommandBindings.Clear();
            SupportedPropertyCommands supportedCommands = ~SupportedPropertyCommands.PinnedEditor;

            resourceValueModel.PropertyEditingHelper.AddCommandBindings((UIElement)resourceValueHost, supportedCommands);
            resourceValueHost.CommandBindings.Add(new CommandBinding((ICommand)PropertyValueEditorCommands.ShowExtendedPinnedEditor, new ExecutedRoutedEventHandler(ResourceValueHost.OnShowExtendedPinnedEditor)));
            PropertyInspectorHelper.SetOwningPropertyInspectorModel((DependencyObject)resourceValueHost, (IPropertyInspector)resourceValueModel);
            PropertyInspectorHelper.SetOwningPropertyInspectorElement((DependencyObject)resourceValueHost, (UIElement)resourceValueHost);
        }