I want a user control called Segmented Panel that contains 3 buttons of which I want to modify their names (Title1/2/3) from a XAML screen.
MainPage XAML:
<local:SegmentedControl HorizontalAlignment="Left" Margin="43,62,0,0" x:Name="segmentedControl1" VerticalAlignment="Top" Title1="ENTER BUTTON NAME HERE" Title2="blah.." Title3="Last Button" Loaded="segmentedControl1_Loaded" />
SegmentedControl XAML.CS:
public static readonly DependencyProperty Title1Property
= DependencyProperty.RegisterAttached("Title1", typeof(String), typeof(StackPanel),
new PropertyMetadata(""));
public static void SetTitle1(UIElement element, String value) {
element.SetValue(Title1Property, value);
}
public static string GetTitle1(UIElement element) {
return (string)element.GetValue(Title1Property);
}
public string Title1 {
get { return GetValue(Title1Property).ToString(); }
set { SetValue(Title1Property, value); }
}
In expression blend I open up the Segmented Panel, choose button1, in Content I tried chosing both Data Context and Element Value, then scrolling down to choose "Title1", but when I compile it, the button's contents never changes.
Can anybody help me out?