why does this GroupBox not work under windows, javascript is Ok, any ideas ?
Code: Select all
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Markup;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media;
namespace Windows.UI.Xaml.Controls
{
public class GroupBox : Border
{
private StackPanel MainGrid = null;
private TextBlock HeaderTB = null;
private ContentControl ContentCC = null;
public GroupBox()
{
MainGrid = new StackPanel();
//MainGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
//MainGrid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) });
HeaderTB = new TextBlock();
HeaderTB.Text = "Header";
MainGrid.Children.Add(HeaderTB);
ContentCC = new ContentControl();
MainGrid.Children.Add(ContentCC);
Grid.SetRow(ContentCC, 1);
BorderBrush = new SolidColorBrush(Colors.Black);
BorderThickness = new Thickness(1);
HeaderTB.BorderBrush = new SolidColorBrush(Colors.Black);
HeaderTB.BorderThickness = new Thickness(1);
base.Child = MainGrid;
}
public new UIElement Content
{
get { return (UIElement)GetValue(ContentProperty); }
set { SetValue(ContentProperty, value); }
}
public static new readonly DependencyProperty ContentProperty =
DependencyProperty.Register("Content", typeof(UIElement), typeof(GroupBox), new PropertyMetadata(null, ContentPropertyChanged));
public static void ContentPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
GroupBox gb = d as GroupBox;
if (gb != null)
{
gb.ContentCC.Content = e.NewValue;
}
}
public string Header
{
get { return (string)GetValue(HeaderProperty); }
set { SetValue(HeaderProperty, value); }
}
public static readonly DependencyProperty HeaderProperty =
DependencyProperty.Register("Header", typeof(string), typeof(GroupBox), new PropertyMetadata("", HeaderPropertyChanged));
public static void HeaderPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
GroupBox gb = d as GroupBox;
if (gb != null)
{
gb.HeaderTB.Text = e.NewValue.ToString();
}
}
}
}
Regards,
CyborgDE