This enables animation, styling, binding, etc. Using a DependencyProperty as the backing store for LeftButtonGroupElement. Public static readonly DependencyProperty RightButtonGroupElementProperty =ĭependencyProperty.Register("RightButtonGroupElement", typeof(FrameworkElement), typeof(GenericPopUpView), new PropertyMetadata(null)) Using a DependencyProperty as the backing store for RightButtonGroupElement. Public static readonly new DependencyProperty FontSizeProperty =ĭependencyProperty.Register("FontSize", typeof(int), typeof(GenericPopUpView), new PropertyMetadata(14)) Using a DependencyProperty as the backing store for Fontsize. Public partial class GenericPopUpView : UserControl / Interaction logic for GenericPopUpView.xaml Here's my code behind : using System.Windows I found this thread : How to create a WPF UserControl with NAMED contentīut none of the solutions helped me :/ Since it's an old topic, i hope it can now be solved. Unfortunately, I need want to bind some content from one section to content of another. My problem is that any content added to these ContentControls cannot be given a name. I then exposed these "ContentControls" with dependencyProperties. Therefore, I created a usercontrol to hold some content at 3 different places. Xmlns:customUsercontrols="clr-namespace:View.I need to create several popups. SetValue(SelectedColorDependencyProperty, value) Return (Brush)GetValue(SelectedColorDependencyProperty) SetValue(HoverColorDependencyProperty, value) Return (Brush)GetValue(HoverColorDependencyProperty) Public static readonly DependencyProperty SelectedDependencyProperty = DependencyProperty.Register("Selected", typeof(Boolean), typeof(HintTextBox)) ![]() Public static readonly DependencyProperty SelectedColorDependencyProperty = DependencyProperty.Register("SelectedColor", typeof(Brush), typeof(HintTextBox)) Public static readonly DependencyProperty HoverColorDependencyProperty = DependencyProperty.Register("HoverColor", typeof(Brush), typeof(HintTextBox)) Nameof(Children), // Prior to C# 6.0, replace nameof(Children) with "Children" Public static readonly DependencyPropertyKey ChildrenProperty = DependencyProperty.RegisterReadOnly( Public partial class ClickableControl : UserControl This is my UserControl = ClickableControl namespace View.custom_usercontrols SetValue(HintepDependencyProperty, value) Return (string)GetValue(HintepDependencyProperty) Public static readonly DependencyProperty HintepDependencyProperty = DependencyProperty.Register("Hint", typeof(string), typeof(HintTextBox)) public string Hint Public partial class HintTextBox : TextBox This is how I put the textbox in my Usercontrol Or what I did wrong? can someone help me? The classes below are the usercontrol and the hinttextbox, the last one is how I implmented them in xaml. 'HintTextBox' is under the scope of element 'ClickableControl', which already had a name registered when it was defined in another scope Cannot set Name attribute value 'SearchT' on element 'HintTextBox'. When I rebuild my solution in visual studio i get this error. ![]() I'm creating a WPF program and I have created a custom Usercontrol and custom Textbox
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |