Search Results

Search found 9012 results on 361 pages for 'wpf binding'.

Page 71/361 | < Previous Page | 67 68 69 70 71 72 73 74 75 76 77 78  | Next Page >

  • Undo/Redo Support for Table Changes in WPF RichTextBox

    - by Jeff
    As part of an editor project, I need to add functionality to the WPF RichTextBox control to allow the user to perform operations on a table. One of those operations is to apply a new width value to one or more columns of the table. I have a function that is applying a new Width value to the TableColumn objects in question, and the table is resizing itself nicely. However, I've noticed that the column-width change operation does not seem to be added to the undo stack. In other words, if a user types something, then changes a column width, then selects undo, the RichTextBox control undoes the user's typing. Undo and redo don't seem to be picking up the property change on the TableColumn object. Is there some way to make this operation occur in a way that it actually is undoable/redoable?

    Read the article

  • How do I ensure only the headers are shown for the first item in an ItemsControl in WPF?

    - by Dan Ryan
    I am using MVVM binding an ObservableCollection of children to an ItemsControl. The ItemsControl contains a UserControl used to style the UI for the children. <ItemsControl ItemsSource="{Binding Documents}"> <ItemsControl.ItemTemplate> <DataTemplate> <View:DocumentView Margin="0, 10, 0, 0" /> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> I want to show a header row for the contents of the ItemsControl but only want to show this once at the top (not for every child). How can I implement this behaviour in the DocumentView user control? Fyi I am using a Grid layout to style the child rows: <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="34"/> <ColumnDefinition Width="100"/> <ColumnDefinition Width="*" /> <ColumnDefinition Width="60" /> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition /> <RowDefinition /> </Grid.RowDefinitions> <TextBlock Grid.ColumnSpan="4" Grid.Row="0" Text="Should only show this at the top"></TextBlock> <Image Grid.Column="0" Grid.Row="1" Height="24" Width="24" Source="/Beazley.Documents.Presentation;component/Icons/error.png"></Image> <ComboBox Grid.Column="1" Grid.Row="1" Name="ContentTypes" ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type View:MainView}}, Path=DataContext.ContentTypes}" SelectedValue="{Binding ContentType}"/> <TextBox Grid.Column="2" Grid.Row="1" Text="{Binding Path=FileName}"/> <Button Grid.Column="3" Grid.Row="1" Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type View:MainView}}, Path=DataContext.RemoveFile}" CommandParameter="{Binding}">Remove</Button> </Grid>

    Read the article

  • How can I avoid the overflow when wheel scolling WPF DataGrid

    - by Jan Bannister
    When I use the mouse wheel to scroll the WPF Toolkit DataGrid on a Vista 64 Machine I get a cryptic low level error: at System.IntPtr.op_Explicit(IntPtr value) at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) I logged an issue on CodePlex. But has anyone found a way to resolve this already?

    Read the article

  • Image surrounded by text in WPF

    - by niao
    Greetings, I have some control which display bunch of textblocks and image. I would like the image to be surrounded by text. I have already implemented some functionality by using FlowDocument and custom bindable run control. (These controls are included inside user control). When I generate lots of these controls in treeview, application goes into infinite loop. I asked on forums before about this problem and the answer was that it can be WPF issue. Howver when I removed bindable run from my user control, problem dissappeared. Now I am trying to implement other solution where image will be surrounded by text. Can someone please help me? EDIT: Generally i would like to achieve something like this

    Read the article

  • How to add a Page to Frame using code in WPF

    - by Robert Höglund
    I have a Window where I have put a Frame. I would like to add a Page to the Frame when I click a button that is also on the Window but not in the Frame. There are several buttons in the Window and each click on a button should load a different Page in the Frame. Since I'm a total newbie on this WPF stuff it's quite possible that this approach is not the best and I have thought about replacing the Frame with a Canvas and then make UserControls instead of Pages that will be added to the Canvas. I welcome any ideas and suggestions on how to best solve this. I aiming for a functionality that is similar to the application Billy Hollis demonstrated in dnrtv episode 115. (http://dnrtv.com/default.aspx?showID=115).

    Read the article

  • Visual Studio massive renaming of controls in WPF project

    - by Mark
    I have a scene in my WPF project with about 2000 different user controls: <local:MyControlType x:name="aaka4sn9f" /> <local:MyControlType x:name="aaks22nf_1" /> <local:MyControlType x:name="aa66s2f_2" /> and so on down the screen... Is there a way to rename all of these controls using Visual Studio (and possibly a regex) to be: <local:MyControlType x:name="myControl1" /> <local:MyControlType x:name="myControl2" /> <local:MyControlType x:name="myControl3" /> ?? Thanks a lot!

    Read the article

  • WPF Validation of clipboard Data

    - by Peter
    Hello normal validation is always related to some control, but in my case there is no control to fire validation when its content changes and to show errortemplate to the user. because the data to be validated is in the cipboard. when the user presses "PASTE" button viewmodel processes the data and finds it to be invalid. but what is the best way to invoke WPF validation in this case? as far as i understand using IDataErrorInfo is the way to go, but what is the best way to start validation. and whst is the best way of displaying the error? errortemplate of the button element? Thanks a lot for help. Peter

    Read the article

  • WPF Application - Role Management Recommendations

    - by David Ward
    I have a WPF application with a WCF service layer and a SQL database. I now want to restrict elements of the application so that certain functions are only available to those users with a particular role. For example, you will only be able to navigate to the settings screen if you are an administrator. I would like a user to be a member of 1 or more authorisation groups and each authorisation group to have 1 or more roles associated. A long time ago I used AzMan (Authorisation Manager) to do a similar thing. Does anyone think that there are better approaches? Is AzMan "old news"? Alternatives? Thanks.

    Read the article

  • WPF TreeView PreviewMouseDown on TreeViewItem

    - by imekon
    If I handle the PreviewMouseDown event on TreeViewItem, I get events for everything I click on that TreeViewItem include the little +/- box to the left (Windows XP). How can I distinguish that? I tried the following: // We've had a single click on a tree view item // Unfortunately this is the WHOLE tree item, including the +/- // symbol to the left. The tree doesn't do a selection, so we // have to filter this out... MouseDevice device = e.Device as MouseDevice; // This is bad. The whole point of WPF is for the code // not to know what the UI has - yet here we are testing for // it as a workaround. Sigh... // This is broken - if you click on the +/- on a item, it shouldn't // go on to be processed by OnTreeSingleClick... ho hum! if (device.DirectlyOver.GetType() != typeof(Path)) { OnTreeSingleClick(sender); } What I'm after is just single click on the tree view item excluding the extra bits it seems to include.

    Read the article

  • Making "helper" windows in WPF

    - by RandomEngy
    I'm writing an app in WPF and want to make a "helper" window. The window needs to be resizable, with no minimize option and doesn't show in the taskbar. If the app receives focus, it should appear as well, but whether or not it's in front or behind the main window should be retained. When the main window is closed, it should close along with the app. An example is a detached pane in Visual Studio. I've made the helper windows not appear in the taskbar, but can't get the rest of the behaviors I want. If they're their own windows, they don't get focus along with the rest of the app. If I specify a the main window as their owner, the main window can't be on top of the helper window. Anyone know a good way to approach this?

    Read the article

  • wpf datagrid textbox + combobox

    - by Muhammad Adnan
    I have wpf datagrid with number of template columns. some of them have textbox in them in edit mode and some combobox. i need to give cut/copy/paste facility to user from main menu (ribbon) buttons of my application. when i select some text from textbox and press copy button from main menu. copy button becomes active control so i loose textbox as active control by which i could get selected text. (any solution for this) and second thing i wanted to ask... is there any event get fired when we select textbox's contents? or solution would be appreciated. Thanks in advance...

    Read the article

  • WPF: Text wrapping not working

    - by Ben
    I've got a grid defined simply: <Grid Margin="0,5,0,0"> <Grid.ColumnDefinitions> <ColumnDefinition Width="50"></ColumnDefinition> <ColumnDefinition Width="50"></ColumnDefinition> <ColumnDefinition Width="48"></ColumnDefinition> <ColumnDefinition Width="Auto"></ColumnDefinition> </Grid.ColumnDefinitions> Then I'm trying to bind some content like this: <TextBlock TextWrapping="Wrap" Grid.Column="3" Text="{Binding Text}"> Set up like this, the text won't wrap. It simply expands the column to fit the text. If I set the Width to a fixed amount on the last column, wrapping works as expected. The problem there is that if the user widens the window, the column stays at a fixed size. How can I get the column to size dynamically with the width of the grid, but still wrap the text within it?

    Read the article

  • Putting binary resources (images) in a separate assembly (WPF/.NET)

    - by haagel
    I have a .NET solution with a couple of projects. The output is a WPF application. Now I would like to put my binary resources (images/icons) in a single project/assembly in this solution, so that all my other projects in can use them. My question is how I can do that? What type of project should I create and how should I reference these resources in my XAML code (in the other projects)? I've tried quite a few things but I can't seem to get it to work...

    Read the article

  • WPF MVVM Property Change Animation

    - by cjibo
    I am looking for a clean way to start an animation that will have dynamic values. Basically I want to do an animation where an element changes width based on the data of another element. Say I have a TextBlock that's Text Property is Binding. When this property changes I want a visual element say a Rectangle for our sake to do a DoubleAnimation changing the width from previous value to the new value. I am trying to stay away from putting code in my view if possible. I've looked into DataTriggers but they seem to require that you know what the value would be such as an Enum. In my case it is just the value changing that needs to trigger a storyboard and the animation would need to start at the current(previous) value and move nicely to the new value. Any ideas. Maybe I just missed a property.

    Read the article

  • How to have a dynamic theme color in WPF

    - by Ingó Vals
    In WPF I have a few resource dictionaries and in them styles for my panels and controls in my app. I'm reusing the same colors again and again. I actually have 5 colors and they give my app a good color-scheme. However if I wan't to change the theme I have to go into the RD's and change each and every color there. I would like to somewhere have the colors set but don't know how or where. I tried to put a color tag in one RD but as soon as I referenced it in the same RD Visual Studio crashed. Also the best solution would be that I could have the color as a dynamic setting in the app itself so users could even change it themselves.

    Read the article

  • Selective coloring on dynamic TextBlock content in WPF

    - by user326579
    For selective coloring of static content the following suggestion works fine : http://stackoverflow.com/questions/2435880/is-it-possible-to-seletively-color-a-wrapping-textblock-in-silverlight-wpf However my content will be generated at runtime. For ex. if the Content generated is : "A Quick Brown Fox" Then I need they string "Brown" to be in color Brown and "Fox" to be in color Red The Keyword-Color list is fixed and available to me at runtime. I have looked at the Advanced TextFormatting page on MSDN, but it is too complicated for me, also the sample in there does not compile :( I am looking at creating a custom control which can do this for me. Let me know if anyone has any idea regarding how to go about this. Thanks in advance.

    Read the article

  • Recommendations on a WPF Docking Library

    - by Brian Stewart
    We are implementing an application that needs dockable windows, similar to Visual Studio 2005/2008, but with multiple "docking sites", unlike VS's single one. Does anyone have a recommendation on a good library for this - either OSS or commercial? I am aware that Infragistics has one, as well as Divelement's SandDock and WPF-Dock from DevComponents, as well as ActiPro's Docking & MDI product. There is also one on CodeProject. Has anyone used any of these libraries? Was the experience good or bad? If you have experience with one of them, does it support multiple "docking sites"?

    Read the article

  • WPF - Listbox bound to collection acts as one item

    - by user553765
    Hi, I have a listbox with the ItemsControl binding the ItemsSource to a readonly collection of strings. The ItemTemplate then declares the DataTemplate as a checkbox where its content is that of the name of the particular item in the collection and IsChecked bound to a property to determine whether or not the item is selected (it's just a listbox of checkboxes) This works fine with one exception - MouseOver the ListBox and it acts as if the collection of Strings is a single item; the whole box acts as if selected. This wouldn't be as much of a problem were it not for this also affecting the scrollbars where they won't get enabled - presumably because it considers the one item as being visible on the screen even though it in actual facts is x+ with only x-y showing on the screen. How do I get the listbox to act as if each individual string is its own item. I assume it acts this way because I declared a datatemplate in order to get a listbox of checkboxes?? Any help would be much appreciated!

    Read the article

  • ComboBox WPF Databinding to a DataView

    - by Oleg
    Hello Everyone! Lets say I have one ComboBox and 2 TextBox items on my GUI. And I have one DataView with data (City, PostalCode, Street, ID). While initializing the whole thing I fill my DataView with some data :) City 1, 11111, Street 1, 1 City 1, 22222, Street 2, 2 City 1, 33333, Street 3, 3 Now I want to bind this to my ComboBox. DataView is a Class Member called "m_dvAdresses", but this code doesnt help: ItemsSource="{Binding Source=m_dvAdresses}" SelectedValuePath="ID" DisplayMemberPath="Street" Also I want to have my 2 ComboBox items to show PostalCode and City, depending on what to i pick in my ComboBox. Like if I pick "Street 2", TextBox1 show me "City 1" and TexBox2 show me "22222"... How can I bind all of them ONLY in the WPF code? Thanks for help!!!!!!!!!!! :)

    Read the article

  • Programatically WPF Fade In (via extension methods)

    - by Dinis Cruz
    I'm trying to write a simple (stand alone) C# extension method to do a Fade-In of a generic WPF UIElement, but the solutions (and code samples) that I found all contain a large number of moving parts (like setting up a story, etc...) For reference here is an example of the type of API method I would like to create. This code will rotate an UIElement according to the values provided (fromValue, toValue, duration and loop) public static T rotate<T>(this T uiElement, double fromValue, double toValue, int durationInSeconds, bool loopAnimation) where T : UIElement { return (T)uiElement.wpfInvoke( ()=>{ DoubleAnimation doubleAnimation = new DoubleAnimation(fromValue, toValue, new Duration(TimeSpan.FromSeconds(durationInSeconds))); RotateTransform rotateTransform = new RotateTransform(); uiElement.RenderTransform = rotateTransform; uiElement.RenderTransformOrigin = new System.Windows.Point(0.5, 0.5); if (loopAnimation) doubleAnimation.RepeatBehavior = RepeatBehavior.Forever; rotateTransform.BeginAnimation(RotateTransform.AngleProperty, doubleAnimation); return uiElement; }); }

    Read the article

  • Arbitrary Header content for each row in WPF datagrid

    - by tk
    I'm trying to put row header text based on a converter function of the index of the row. I found a way to bind to the datagridrow like below, but i can't find how to get the row index of the datagridrow object. <DataTemplate x:Key="MyRowHeaderTemplate" DataType="DataRowView"> <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Margin="1,0,1,0" Padding="1,0,1,0" Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type DataGridRow}}, Path=Item}"/> </DataTemplate> How can i get the row index and use my converter function to set the row header text?

    Read the article

  • WPF Show wait cursor before application fully loads

    - by e28Makaveli
    I want to show the wait cursor before my WPF application, composed using CAL, fully loads. In the constructor of the main window, I have the following code: public MainWindow([Dependency] IUnityContainer container) { InitializeComponent(); Cursor = System.Windows.Input.Cursors.Wait; Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait; ForceCursor = true; //this.Cursor = System.Windows.Input.Cursors.AppStarting; // event subscriptions PresenterBase.EventAggregate.GetEvent<ModulesLoadedEvent>().Subscribe(OnModulesLoaded); } After all modules have been loaded, the following handler is invoked: private void OnModulesLoaded(EventArgs e) { allModulesLoaded = true; Mouse.OverrideCursor = null; Cursor = System.Windows.Input.Cursors.Arrow; } Problem is, I do not see this wait cursor. What I am missing here? FWIW, I got a hint from this post http://stackoverflow.com/questions/2078766/showing-the-wait-cursor TIA.

    Read the article

  • Find selected WPF Listbox entries

    - by wonea
    I've been trying iterate through the selected items of a listbox in WPF, with the following code; try { for (int i = 0; i < mylistbox.SelectedItems.Count; i++) { ListItem li = (ListItem)mylistbox.SelectedItems[i]; string listitemcontents_str = li.ToString(); } } catch(Exception e) { // Error appears here string error = e.ToString(); } However I receive an invalid cast exception; System.InvalidCastException: Unable to cast object of type 'mylist' to type 'System.Windows.Documents.ListItem'. Is there a way around this?

    Read the article

  • How do I use global resources in WPF?

    - by Banford
    I have a WPF application which I would like to use some static resources in. I have created a Resource Library XAML file which contains a resource. I have also added a string into the Resources of the project through the Properties panel. I assumed I could just use these resources with the binding expression: {StaticResource ResourceName} But visual studio is telling me the resources are not found. Do I have to include some form of reference in my XAML? The examples I have seen only include resources locally such as: <Window.Resources>, <Page.Resources> etc I don't want to include the resources locally because I want them to be available to multiple parts of the application.

    Read the article

  • Trouble with creating WPF window extended on the title area (like Office 2007/2010)

    - by Rikker Serg
    I want to make WPF window extended on the title area (like Office 2007/2010). I implemented DwmWindow (see DwmTest.zip) where I put required stuff. Commonly, it works fine except one disgusting thing: the window appears as white rectangle (see DwmIssue.png) and after a few second this rectangle disappears and the content of the window is shown (see DwmIssueCorrect.png). This bug is essential only for my window. If I remove this lines it works fine (without it aero will not showed on title): HwndSource mainWindowSrc = HwndSource.FromHwnd(handle); if (mainWindowSrc != null) mainWindowSrc.CompositionTarget.BackgroundColor = Colors.Transparent; NativeMethods.MARGINS margins = new NativeMethods.MARGINS(0, 50, 0, 0); NativeMethods.DwmExtendFrameIntoClientArea(handle, margins); How can I eliminate this white rectangle? (To run a sample DwmTest.zip WinVista/7 with DWM enabled and .NET 4.0 is required. To compile sample you will need Visual Studio 2010)

    Read the article

< Previous Page | 67 68 69 70 71 72 73 74 75 76 77 78  | Next Page >