custom-controls

WPF design question (custom control or mvvm)

天涯浪子 提交于 2019-12-14 00:33:03
问题 Here is the scenario: I have a visual that displays some data The data to the visual can come in one of two ways Via user input through the keyboard or mouse Via some backend source Both these data inputs can be of one of two forms Control data or Raw data for simple display Control data causes changes in the visual Raw data is simply showed as is In other words, the view is being served by two masters, viz user input and backend input. An example would be a multi-user game that has visuals

How do I bind a command to e.g. the right mouse button in a ControlTemplate in WPF?

巧了我就是萌 提交于 2019-12-13 19:24:00
问题 I have a custom Control derived class and a view model to go with. The user can do several actions with this control, and I'm thinking it's best to implement these as RoutedCommand objects or ICommand derived objects in the view model so the ControlTemplates can bind to them. Binding a command to a button in one ControlTemplate should be straightforward, but how can I bind the command to e.g. the right mouse button in another ControlTemplate? Probably a MouseGesture is involved, but I'm

Passing parameters to custom control (databinding)

僤鯓⒐⒋嵵緔 提交于 2019-12-13 19:09:42
问题 I want to create a custom control with 2 parameters to be databindable. The parameters are ExchangeCode and TickerCode Currently, here is what I am trying (which doesn't work) : This is my custom control public partial class Graph : UserControl { public Graph() { InitializeComponent(); } public static readonly DependencyProperty ExchangeCodeProperty = DependencyProperty.Register ( "ExchangeCode", typeof(string), typeof(Graph), new PropertyMetadata(string.Empty) ); public string ExchangeCode {

android custom text view can not be added in layout file

*爱你&永不变心* 提交于 2019-12-13 17:43:02
问题 I have created a custom text view just to solve the problem in my previous question I have gone through many tutorials and many samples. I have created a custom text view but it can not be added into any layout file. It just throws an error on layout file stating that the class is not found. However I have written the same class. What i want to know is what should i need to take care when i am creating a custom text view? My only requirement to create a custom text view to have the arial

Winform customize listbox item

给你一囗甜甜゛ 提交于 2019-12-13 15:44:30
问题 I have a listbox that should display data that contains 2 fields: time and a message. Instead of displaying 1 line of text, I want each item to be displayed as 2 lines - 1st line is the time and the 2nd line is the message, where each line has a different style. How can I do this? I can bind the object array to the listbox, but how do I style it? Thanks for your answers. 回答1: I'll just formally post an answer earlier left in a comment. You'll need to use the DrawMode property, there's a good

I need a .NET custom controls libraries [closed]

拈花ヽ惹草 提交于 2019-12-13 15:30:01
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I am looking for controls for C# like extended tab,grid,textbox,button. Any help is appreciated. edit: I am using VS2010 and It would be nice if you mention any opensource or free libraries. 回答1: Check out Krypton Toolkit (WinForms). The library is free to use and extends the existing controls. 回答2: I'm very

Gridsplitter in a Grid with an ItemsControl

微笑、不失礼 提交于 2019-12-13 14:32:18
问题 I'm trying to make a PropertyGrid Custom Control. The PropertyGrid will be very similar to the PropertyGrid used in Visual Studio. I've tried using the PropertyGrid of the Extended WPF Toolkit but you have to specify the category of a property with an attribute and we need to change the categories runtime. Which as far as I know is impossible with attributes. So I'm making the PropertyGrid myself. This is my code so far: The Generic.xaml: <ResourceDictionary xmlns="http://schemas.microsoft

How to wire up a click event for a custom usercontrol button? Should I use CustomControl?

允我心安 提交于 2019-12-13 12:04:54
问题 I wanted to create a button that had an image and a textblock as content. So I went about looking for an answer and found a post ( Reusable Custom Content for Buttons ) which told me to create a usercontrol. I did this and it works great. I can set the image source and text through dependency properties. However, I am stuck as there is no click event for my control. I did a little more digging and concluded that I probably need a CustomControl derived from Button. Is this correct? Or would it

There are no components in DLL that can be placed on toolbox

社会主义新天地 提交于 2019-12-13 11:39:36
问题 I have a DatePicker custom control that I am trying to add to toolbox. The name of the file is BasicFrame.WebControls.BasicDatePicker.dll and I go through the procedure of right click in Toolbox > Choose Items and then selecting the file after browsing to it under .NET Framework components. I however get this error message: There are no components in that can be placed on toolbox Why do I get this message and how can I resolve it? 回答1: Have you checked the visibility of the custom classes? If

Winforms SplitterPanel, z-index of child overlap split

谁说胖子不能爱 提交于 2019-12-13 08:26:26
问题 I am working with a SplitterPanel in winforms where on the right hand side I want a custom dropdown list control which displays a 2 columns dropdown list. The problem is that with there being two columns I want to be able to have a larger dropdown list area than the actual dropdown, and therefore overlap the SplitterPanel if the list doesn't fit in the split area. I have tried using .BringToFront(); , however this does not work on the SplitterPanel and the control is hidden. I come from a web