private ContentControl CreateControl(object content) { var control = new MosaicItem { Content = content, CommandParameter = content, HorizontalContentAlignment = HorizontalAlignment.Stretch, VerticalContentAlignment = VerticalAlignment.Stretch }; control.SetBinding(ContentControl.MarginProperty, new Binding { Source = this, Path = new PropertyPath("ItemMargin") }); control.SetBinding(ContentControl.ContentTemplateProperty, new Binding { Source = this, Path = new PropertyPath("ItemTemplate") }); control.SetBinding(Button.CommandProperty, new Binding { Source = this, Path = new PropertyPath("ItemClickCommand") }); return(control); }
private ContentControl CreateControl(object content) { var control = new MosaicItem { Content = content, CommandParameter = content, HorizontalContentAlignment = HorizontalAlignment.Stretch, VerticalContentAlignment = VerticalAlignment.Stretch }; control.SetBinding(ContentControl.MarginProperty, new Binding { Source = this, Path = new PropertyPath("ItemMargin") }); control.SetBinding(ContentControl.ContentTemplateProperty, new Binding { Source = this, Path = new PropertyPath("ItemTemplate") }); control.SetBinding(Button.CommandProperty, new Binding { Source = this, Path = new PropertyPath("ItemClickCommand") }); return control; }