wpf-controls

Managing Multiple Views/ViewModels In A Single ContentControl

邮差的信 提交于 2020-01-12 08:47:12
问题 I have an application which shows a single View at a time in a ContentControl. I have a current solution, but was curious if there is a better one for memory management. My current design creates new objects when they need to be displayed, and destroys them when they are no longer visible. I'm curious if this is the better approach, or maintaining references to each view and swapping between those references is better? Here is a little more explanation of my application layout: A very

WPF repeating elements

元气小坏坏 提交于 2020-01-12 05:42:05
问题 I have a UserControl that is a button, with certain characteristics, and I have a window that has several of these buttons in their "normal" style. On this same window, I have defined a style that overrides some of the normal characteristics, and I want a bunch of them (sort of like a keyboard layout). What I have is a UniformGrid with 30 lines like this: <wft:TouchButton Style="{StaticResource smallButtonStyle}" Click="TouchButton_Click" Tag="1">1</wft:TouchButton> <wft:TouchButton Style="

Free Syntax Highlighting .NET Editor

半世苍凉 提交于 2020-01-12 04:52:08
问题 I need incorporate a syntax highlighting editor control into my application. It is required that the control be free and native .NET code only so the Scintilla.NET control is not feasible. The reason for this is because it is a ClickOnce application. I would like answers that use WinForms or WPF. It doesn't have to be from the same vendor. It needs to basically support syntax highlighting, line numbers, and be reasonably fast for large files up to 100,000 and MUST be FREE! I understand that

What is the easiest to animate the position of button in wpf?

拈花ヽ惹草 提交于 2020-01-11 12:58:31
问题 I want to move a button across a canvas when it's clicked in a way that it changes its position gradually(animation), not vanishing and reappearing in the new position. 回答1: You can use a Storyboard that will move it smoothly: <Grid> <Canvas> <Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="50,250,0,0" Name="buttonAnimate" VerticalAlignment="Top" Width="75"> <Button.Triggers> <EventTrigger RoutedEvent="Button.Click"> <BeginStoryboard> <Storyboard> <DoubleAnimation From=

programmatically addressing a canvas created in xaml

旧巷老猫 提交于 2020-01-10 05:35:08
问题 I am creating an application in WPF using the MVVM approach. I am fairly new to the topic and I'm looking on pointers how to achieve the following: I have created a canvas in XAML, as follows: <canvas name = "myCanvas"> ... </canvas> I added a button, also in XAML, which I want to use to draw (programmatically) some basic shapes (line, rectangle, etc.) onto the existing canvas on mouse click. Since I'm using the MVVM approach, the button's command has to be bound to a method, as follows:

multitouch in WPF Not working

流过昼夜 提交于 2020-01-07 09:34:20
问题 I'm new to multi touch programming. im using windows7, VS-2010 and WPF to develop.I follow the tutorial in this link: http://surfacedeveloper.blogspot.in/2009/10/multi-touch-in-wpf-40-and-vs2010.html here i don't have the property ManipulationMode="All" . I don't know what I'm doing wrong. please help me!!! 回答1: ManipulationMode seemed to be a UIElement property in .NET 4.0 beta 1. I guess it was what now is IsManipulationEnabled. 来源: https://stackoverflow.com/questions/11931748/multitouch-in

Wpf nesting containers

柔情痞子 提交于 2020-01-07 04:43:11
问题 On a window control, my main container is a grid. My grid has 2 rows, one row definition is 50*, and the other is 250*. Now i want to add a right sidebar, lets say with a StackPanel. I would like to have a ListBox inside the StackPanel that aligns with the 50* grid row, so as the window height gets bigger, the ListBox size will also get bigger. My question is whether i can achieve this behavior while the ListBox is inside the StackPanel (which is nested inside the grid) or must the ListBox be

One popup for all button

空扰寡人 提交于 2020-01-06 23:51:42
问题 As topic mentioned.I want to use only one popup for all button in my application.I don't know how to get what I want. Here is what my window looks like: Info 1 : Info 2: You can see popup appear on wrong position.I know I can position a popup by setting the PlacementTarget.But each Popup has a different value for the placement property.That is the problem.I'm looking another way to do it. Here is a popup for option 1: <StackPanel Orientation="Horizontal"> <!--Option 1: text and button-->

How can I bind one property to another property, offset by a specific amount?

不问归期 提交于 2020-01-06 14:18:56
问题 I'm trying to bind two points of a line to two Ellipses, which are inside ScatterViewItems. At the moment, I'm able to bind to ActualCenter.X and .Y for the ScatterViewItem, which works, but because the ellipse is not the only element in that ScatterViewItem (there is also a label), it's off-center, such that the line's endpoints are not the center of the ellipse. Ellipse doesn't have an ActualCenter property. I wanted to know whether I'm able to offset a property binding by a fixed amount,

Create an event handler for control created programmatically

元气小坏坏 提交于 2020-01-06 12:43:47
问题 I am working on a WPF application and what I want is if a specific Radio Button from group A is selected the program creates a second set of Radio Buttons call them group B and at the same time a disabled textbox. Now I want to create an event so if the user Selects option 3 from Group B the text box becomes enabled and when it is unselected it disables again. Now I have the working programmatically but when I try to create the event handlers I am referencing a non-existent control and it won