Search Results

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

Page 93/361 | < Previous Page | 89 90 91 92 93 94 95 96 97 98 99 100  | Next Page >

  • Access properties controls of a window from a page in WPF

    - by toni
    Hi, My problem is that I want to access from a page to the properties of a control (button, textblock, label, or a menuitem of the window....) placed in a window. The page is placed into the window. How can I do this? Is there any method to find controls by name in a specific window or page or entire application? Thanks.

    Read the article

  • Displaying a list of Items in a WPF form using XAML

    - by Dave Colwell
    Hi guys, I am attempting to display a list of items (the style and controltemplate for these items are defined elsewhere) and i want to be able to add/remove as many as i want to. As i do not have infinite screen realestate I am displaying these in a ListBox control. This is the screen i have to date: What is going to happen is this. When i click the New button, i want the item to appear in the outlined area. So now for the problem: I want, when i click the New... Button, a new item to appear in the ListBox (outlined). Is it possible to do this using XAML? I am trying to work on seperating the business logic from the interface, so if there were some way to acheive this in XAML i would appreciate it. If not,can i use the custom templated item i have created in C# so that it will appear as the template specifies in the list box instead of like a normal ListBoxItem Thanks in advance!

    Read the article

  • WPF Listview- What would be the best way to display data from different ObservableCollections based

    - by highone
    I have three ObservableCollections: CharacterCollection, LocationCollection, and ItemCollection. They are all collections of objects; CharacterCollection is a collection of Character Objects. I need to display, in the listview, information from the collection determined by the user clicking on a button. I would prefer to use databinding, but I don't see a clear cut way to do that with multiple collections containing different types of objects. What would be the best way to easily switch between collections?

    Read the article

  • WPF Style: how to change GradientStop Color in Trigger

    - by Nike
    I have a Button Style: <Style x:Key="ButtonStyle1" TargetType="{x:Type Button}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Grid> <Path x:Name="path1" ... Data="...some data..."> <Path.Fill> <LinearGradientBrush EndPoint="0.5,-0.3" StartPoint="0.5,0.8"> <GradientStop x:Name="gs1" Color="Green" Offset="0.44"/> <GradientStop Color="Black" Offset="0.727"/> </LinearGradientBrush> </Path.Fill> </Path> <ContentPresenter ...properties... /> </Grid> <ControlTemplate.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter TargetName="???" Property="Color" Value="Green"></Setter> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> I want to change the Color of GradientStop with x:Name="gs1" when mouse is over button, so I use Trigger IsMouseOver. How can i get an access to Color Property in Trigger? I tried TargetName="path1.gs1" but it doesn't work. Any idea?

    Read the article

  • WPF DockPanel doesn't respect the "Filled" control's desired size

    - by Dan Puzey
    I have the following Xaml (simplified for brevity, but will repro the problem in Xamlpad or Kaxaml): <DockPanel Width="400"> <TextBlock DockPanel.Dock="Left" TextWrapping="Wrap"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum massa metus, ornare in fringilla nec, fringilla at orci. Nunc pharetra enim sit amet sapien aliquet eu euismod turpis vehicula. Aenean gravida tempus lectus ut ornare. Nullam massa augue, suscipit vel consectetur fringilla, pretium vitae neque. </TextBlock> <Button MinWidth="100" VerticalAlignment="Center" HorizontalAlignment="Left">Hello world</Button> </DockPanel> My problem is that I want the Button to take its minimum 100px of space, and for the text to wrap suitably to leave that space. However, what happens is that the text wraps as close to 400px as possible, and then the Button is clipped. If I Snoop the output I can see that the button is rendering at the desired 100px, but it's being clipped off the side of the DockPanel. If I reverse the Dock (so the button is docked "Right" and the TextBlock fills) then I get the layout I want, but unfortunately that's not an option due to the surrounding layout. Is there something I can do that will make the DockPanel a) not clip and b) layout in a way that respects the MinWidth? Or am I stuck finding an alternative layout mechanism? Thanks in advance!

    Read the article

  • Adding a BitmapEffect to a BitmapImage in WPF

    - by Richard
    I have a png image of the earth which I'm trying to add an OuterGlowBitmapEffect to. I've done something similar with a simple Elipse, but BitmapImage doesn't seem to allow a BitmapEffect to be applied to it. The following XAML isn't valid, but is there a valid way of doing this? <BitmapImage UriSource="/Media/earth.png"> <BitmapImage.BitmapEffect> <OuterGlowBitmapEffect GlowColor="Cyan" GlowSize="10" /> </BitmapImage.BitmapEffect> </BitmapImage> The png in question is the top half of the earth and has a transparent background. Thanks for your help.

    Read the article

  • Assigning the Tag Property of a Control in WPF

    - by jmayor
    If I have 7 checkBoxes, one for each day of the week, Can I assing in XAML the Tag property to each one of the the System.DayOfWeek enumeration value? <StackPanel > <StackPanel.Resources> <system:DayOfWeek x:Key="Monday" >Monday</system:DayOfWeek> </StackPanel.Resources> <CheckBox Name="chkMo" Tag="{StaticResource Monday}">Mo</CheckBox> ... </StackPanel> Is there a way to assign directly the enum value to the tag without using resources?

    Read the article

  • Compare GetNextInsertionPosition and GetNextContextPosition in WPF

    - by paradisonoir
    As I enter a character in my RichTextBox, I want to get the next character from the its TextRange. So here is how I do it: TextPointer ptr1= RichTextBox.CaretPosition; char nextChar = GetNextChar(); while (char.IsWhiteSpace(nextChar)) { ptr1= ptr1.GetNextInsertionPosition(LogicalDirection.Forward); nextChar = GetCharacterAt(Ptr1); } then I get the ptr1 of the next character and from the TextPointer, I get the TextRange, and do my changes. So here is the problem? when the next word is spelled correctly, I have no problem, but if it's not spelled properly then ptr1 would not point to the first character of the next word (the second character), and if I use GetNextContextPosition(LogicalDirection.Forward) it would give me the first letter of the next word if it's misspelled. So depending on the spelling only one of them works? I was just wondering if you have any idea about this problem? Is there anything wrong I am doing here?

    Read the article

  • Deleting an Image that has been used by a WPF control

    - by Peter
    Hi, I would like to bind an Image to some kind of control an delete it later on. path = @"c:\somePath\somePic.jpg" FileInfo fi = new FileInfo(path); Uri uri = new Uri(fi.FullName, UriKind.Absolute); var img = new System.Windows.Controls.Image(); img.Source = new BitmapImage(uri); Now after this code I would like to delete the file : fi.Delete(); But I cannot do that since the image is being used now. Between code fragment 1 en 2 what can I do to release it? Thanks

    Read the article

  • Accessing WPF Template for Custom Control from Code behind

    - by Ashwani Mehlem
    Hi, i am trying to access a named grid inside a default template for a custom control from code behind. But it seems that the template for the control is null, even after calling ApplyTemplate(). Is that impossible inside the controls constuctor? Here's the code: Generic.xaml: ... <ControlTemplate TargetType="{x:Type local:TimeTableControl}"> <Grid Name="ContentGrid"> </Grid> </ControlTemplate> ... TimeTableControl.cs: public TimeTableControl() { ApplyTemplate(); contentGrid = (Grid)(Template.FindName("ContentGrid", this)); //Line above causes null-pointer-exception ... }

    Read the article

  • Problems with "global" exception handlers for unhandled exceptions in multithreaded WPF

    - by JustABill
    I have a program that, among other things, needs to be able to refresh the contents of a directory when the user tells it to. The actual task doesn't really matter, but this is the simplest way of causing this problem to occur that I know of. If I tell it to open a directory that doesn't exist, I get the "unhandled exception" dialog in VS with a stack trace of, from outer to inner: [External code] Textbox PreviewKeyUp event [External code] ClassA's path property being set ClassA's internal path update function being called A call to the INotifyPropertyChanged event [External code] A call to the getter for ClassB's list of children A call to ClassB's internal directory list function And then it fails inside this internal function. I have the following in my App.xaml.cs: private void Application_Startup(object sender, StartupEventArgs e) { AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); Application.Current.Dispatcher.UnhandledException += new System.Windows.Threading.DispatcherUnhandledExceptionEventHandler(Dispatcher_UnhandledException); } But neither of their exception handlers are being called. If I run this program from outside VS, I don't get notified of an exception at all, it just breaks because of the invalid input. And yes, the Application_Startup event is being called. How can I properly "trap" this exception so I can provide a friendly error message and kill the program?

    Read the article

  • WPF, ShowGridLines equivalent for wrap panel

    - by user275587
    I need to display a 1 pixel wide border around all wrap panel cells, kinda like excel grid. Unfortunately the wrap panel does not implement the grid ShowGridLines property. I can't put a border inside every cell because adjacent cells will have a 2 pixel border instead of 1 pixel. Since the wrap panel arranges it's layout dynamically and does not expose it's properties I can't evaluate the correct value for a border inside a cell. Any workaround possible?

    Read the article

  • Conditionals in WPF.

    - by Carlos
    I have the following question: I have a Boolean variable in a configuration file. If it is true I want a property in textbox control to be setup according to the value of that variable. Try the solution above but it does not work. What am I doing wrong? This is a fragment code: bool isKeyboardAvtive = true; //read from configuration file .... .....

    Read the article

  • How to Focus on ListviewItem in WPF?

    - by Prashant
    I have ListBox in my application with Ten items, user can see five items at time. Sometimes I'm selecting items from code and setting focus. Selecting an item and focusing work perfectly when items are visible on Form, but for other non-visible items, I'm unable to set the focus (NOTE: after selecting it is visible to user). Can anyone help me please?

    Read the article

  • Adding a button to a combobox in wpf

    - by Chris McGrath
    Pretty much I have an Editable Combobox and I want to add a button to the right of the drop down button which clears the selected item. So... |TextBox |X|v| I was thinking something like... <Style...> <Setter Property="Template"> <Setter.Value> <ControlTemplate> <ControlTemplate.Resources> <Style TargetType="{x:Type TextBox}">...Add button here...</Style> </ControlTemplate.Resources> <ContentPresenter /> </ControlTemplate> </Setter.Value> </Setter> </Style>

    Read the article

  • Problem with focus in WPF

    - by Maurizio Reginelli
    I have an application with a WindowsFormHost, which contains an user control, and a DataGrid. When I hold down the left button on the user control, if the selection on the DataGrid changes (via data-binded property), I lose the focus. How can I solve that problem? Thank you.

    Read the article

  • Get the caret position when losing focus in WPF

    - by DrLazer
    I have two textbox's. I have an event setup for the "onLostFocus" of the textbox's. If i finish typing a word into both boxes one after the other all is well. At the point where i click back on the first textbox i want to click halfway through the word (perfectly resonable thing for a user to do). When the onLostFocus event fires here is my code : void tbox_LostFocus(object sender, RoutedEventArgs e) { IInputElement focusedelement = FocusManager.GetFocusedElement(this); if (focusedelement is TextBox) { TextBox focusedTextBox = focusedelement as TextBox; int focusIndex = m_commandsStacker.Children.IndexOf(focusedTextBox); int caretIndex = focusedTextBox.CaretIndex; The caret index is 0. At that point I refresh the whole form and set parameters and all other kinds of whizzery, storing the texbox index and caret position to put everything back the same. Why does it return 0 and not the position where the caret should be halfway between the word?

    Read the article

  • Interpreting WPF Dependency properties as a set.

    - by moogs
    So, I have a control. It displays an image based some xml document and an optional parameter "Document" - XML document "RenderingOption" - optional image-rendering ( sharpen, soften ) So: <XMLRenderingWidget Document="xxxxxx"/> The above will render the document once <XMLRenderingWidget Document="xxxxxx" RenderingOption="Sharpen"/> The above will, sometimes render the document once, more oftentimes: Perform the rendering of the document as if no Rendering was set then, re-render the document with the Sharpen option I do the rendering on the PropertyChangedCallback assigned to the property. How do I tell the control to "hey, before doing the rendering, apply the changes on the other properties being set, too" Is this not possible? Should I bundle them up as one property instead?

    Read the article

  • Saving a screenshot of a window using C#, WPF, and DWM

    - by Evan
    This is a follow up question to this question The solution to the above uses DWM to display a thumbnail of an active window. If I understand correctly, it works by letting you specify the window handle of the application you want to view and then having you provide a window handle and a location on that window where windows should draw the contents of the target Window. Is there a way to render the window screen shot directly to BitmapImage or Image instead of directly drawing it somewhere in your window? (Basically to just grab a screen shot of the window - even if it's covered by another window - with out using an updating thumbnail.) Thanks for you help!

    Read the article

  • Get rid of button border in WPF?

    - by sanjeev40084
    i am trying to get rid of button border and only display text, however a thin line around the text gets displayed even though i set borderThickness to 0 and borderbrush to transparent. my xaml code for save button: <Button Content="save" Name="btnSaveEditedText" Background="Transparent" Foreground="White" FontFamily="Tw Cen MT Condensed" FontSize="30" Margin="-280,0,0,10" Width="60" BorderBrush="Transparent" BorderThickness="0"/> Is there anyway i can get rid of the button border?

    Read the article

< Previous Page | 89 90 91 92 93 94 95 96 97 98 99 100  | Next Page >