[Solved] How to bind List to a DependencyProperty

The Binding in the UserControl’s XAML should have the UserControl instance as its source object, e.g. like this: <ListView ItemsSource=”{Binding MessageList, RelativeSource={RelativeSource AncestorType=UserControl}}” /> Alternatively you could set x:Name on the UserControl and use an ElementName binding: <UserControl … x:Name=”self”> … <ListView ItemsSource=”{Binding MessageList, ElementName=self}” /> … </UserControl> Besides that you should usually not set … Read more

[Solved] Combobox show and hide ComboBox items in WPF

Create a custom control such as: public class CrazyCombo : ComboBox { static CrazyCombo() { DefaultStyleKeyProperty.OverrideMetadata(typeof(CrazyCombo), new FrameworkPropertyMetadata(typeof(CrazyCombo))); } public int InitialDisplayItem { get { return (int)GetValue(InitialDisplayItemProperty); } set { SetValue(InitialDisplayItemProperty, value); } } // Using a DependencyProperty as the backing store for InitialDisplayItem. This enables animation, styling, binding, etc… public static readonly DependencyProperty InitialDisplayItemProperty … Read more

[Solved] How to reuse a form ( and change its context when needed) to avoid multiple identical forms? C# [closed]

Why do you need a new form class for each country? The idea of a class is that it holds common behaviours. A form is a class. just instantiate an instance of the class with the data that it needs to display. Create a data class to encapsulate the data that the form shows (like … Read more