Beispiel #1
0
        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);
        }
Beispiel #2
0
 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;
 }