public ShapesExporterControl() { DefaultStyleKey = typeof(ShapesExporterControl); this.viewModel = new ShapesExporterViewModel(); DataContext = viewModel; BindingOperations.SetBinding(this, PressedProperty, new Binding("Pressed")); }
static object CoerceFileTypeChanged(DependencyObject d, object baseValue) { ShapesExporterViewModel viewmodel = d as ShapesExporterViewModel; if (viewmodel == null) { return(DefaultFileType); } ListBoxEditItem item = baseValue as ListBoxEditItem; return(item == null ? viewmodel.SelectedFileType : item.Content); }