wpf-controls

how to have many wpf custom controls in the same library?

橙三吉。 提交于 2019-12-11 04:59:32
问题 I have a WPF custom control project in which I want to have many custom controls. By default, VS2015 cummunity creates a Theme folder with a generic.xaml file and a .cs file with the interaction logic. I want to have many user controls, so I have tried to create a MyControl1 folder, inside this folder, I have created a Theme folder and I add a new item, a WPF custom control. But it doesn't create a generic.xaml for this control. I copy from the root folder the default generic.xaml and I

datetime converter WPF

牧云@^-^@ 提交于 2019-12-11 04:53:26
问题 I have this converter that i made to get the current time once the date is selected from the DataPicker. In string Date i am getting the value that was selected from the DatePicker, but i cant seem to only get the date. The format that is coming into the Value property is 9/24/2013 12:00:00 I would like it to be 9/24/2013 the error i am getting is "Error 122 No overload for method 'ToString' takes 1 argument" public object Convert(object value, Type targetType, object parameter, System

WPF Grid allow controls inside to auto size width/height

夙愿已清 提交于 2019-12-11 04:47:31
问题 Hey all i have been trying to find examples of how to go about auto sizing the controls i have within a grid control if the users screen is larger than the default size. Currently i am unable to resize the controls when i enlarge the form. Is there any code currently that can find all controls inside the grid and resize them on the fly when the form is resized? My current code is: <Window x:Class="Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http:/

WPF control develop idea

故事扮演 提交于 2019-12-11 04:41:32
问题 OK, I want to create a control that is like a Stackpanel with TextBlock on the left, something like: The TextBlock need to be editable. So, the question is from whom I need to inherit to make that since cannot from Stackpanel ? 回答1: That is basically a HeaderedItemsControl with a custom Template. The template could be a Grid with two columns, one containing a rotated ContentPresenter which is bound to the header properties, on the right you would have an ItemsPresenter for the items. e.g.

CheckBox two way binding doesn't work

元气小坏坏 提交于 2019-12-11 04:33:08
问题 I want to make two way binding for checkboxes inside ListView. This is my Product class: public class Product { public bool IsSelected { get; set; } public string Name { get; set; } } In ViewModel class I have observable collection of products: private ObservableCollection<Product> _productList; public ObservableCollection<Product> ProductList { get { return _productList; } set { _productList = value; } } public MainViewModel() { ProductList = new ObservableCollection<Product> { new Product

Bind to event in part of a custom control

时间秒杀一切 提交于 2019-12-11 04:06:58
问题 I'm trying to implement the example at: https://github.com/olohmann/WpfRxControls There are three parts to the custom control: PART_TextBox PART_Popup PART_ListBox Relevant source: https://github.com/olohmann/WpfRxControls/blob/master/WpfRxControls/AutoCompleteTextBox.cs https://github.com/olohmann/WpfRxControls/blob/master/WpfRxControls/Themes/Generic.xaml All the pieces are in place, and the code using the new control is as follows: <ctrls:AutoCompleteTextBox Grid.Row="1"

How to retrieve VisualChild from ControlTemplate

时光怂恿深爱的人放手 提交于 2019-12-11 03:56:40
问题 I have a WPF application in .NET 3.5 SP1 which is using TabControl . In that we have TabItems , which in turn have their Styles to determine currently displayed items. Let's say we have a TabItem named Books , now Books will have three stages of display: 1. Loading results, 2. Displaying results, 3. Displaying no results - i.e. nothing found. <TabControl> <TabItem Header="Books"/> <TabItem Header="DVD's"/> ... </TavControl> Now I have 5 TabItems which let's say represent "DVD's", "Blu-Rays",

Moving location of Expander expansion button wpf

徘徊边缘 提交于 2019-12-11 03:54:15
问题 I am new to using wpf and want to use expander to allow the user to show and hide text. I want the expander container to be the entire length of the window height 800. I want to have the expander expand to the right and have the text and expander button be in the center of the expander. I know how to make the expander expand to the right and how to change orientation of the text with a textblock. I can not figure out how to make the location of the text and the button move to the center of

Growing UserControl Size with Style Trigger?

允我心安 提交于 2019-12-11 03:49:28
问题 I would like to cause a custom UserControl to grow by a multiplier when an "IsSelected" DP is set to true. My current XAML looks like this: <ctrl:MyBaseControl x:Class="MyDemo.Controls.MyCustomControl" ...> <ctrl:MyBaseControl.Resources> <Style TargetType="{x:Type ctrl:MyCustomControl}"> <Setter Property="BorderBrush" Value="White" /> <Style.Triggers> <Trigger Property="IsSelected" Value="True"> <Setter Property="BorderThickness" Value="2" /> <Setter Property="Width" Value="340" /> <Setter

listbox isSelected databinding in DataTemplate

孤街浪徒 提交于 2019-12-11 03:47:08
问题 I try to simply databind IsSelected property with IsSelected field in my class. But after I change the value in code, it doesn't change the property, neither does clicking on ListBoxItem change the field value. XAML: <FlipView ItemsSource="{Binding Source={StaticResource itemsViewSource}}" ... > <FlipView.ItemTemplate> <DataTemplate> <UserControl Loaded="StartLayoutUpdates" Unloaded="StopLayoutUpdates"> <!-- other controls --> <ListBox Grid.Row="1" Grid.ColumnSpan="3" SelectionMode="Multiple"