wpf

WPF - Swapping in and out xaml files to create different screen designs

I am creating an application that uses the MS Ribbon Control. The ribbon has a several tabs. The first tab is labeled "View", the next is labeled "Configure". Under View I show a view of our system, which is laid out in the Window1.xaml file. When I press the Configure tab, I would like the View to go away and be replaced by differ...

Define a WPF ControlTemplate at runtime

Hello, I would like to define a ControlTemplate at runtime. Is this possible? I have noticed the VisualTree property on the ControlTemplate class. I have also noticed that it uses the FrameworkElementFactory class. However, I cannot seem to get it to work. Is it possible to create a ControlTemplate at runtime? ...

wpf listview lost the focus

Hi everyone! I have some strange behavior of ListView control in WPF. We are developing application in C#. I created ListView with some items and set SelectedIndex to some index in the middle of its list. Then I clicked mouse at any place on the ListView and then navigate with Up/Dows keyboard keys, everything works perfectly. But If ...

WPF Listview

How to create a GridView like view to the WPF ListView if i dont know the Column names at the design time because the collection will be created at runtime and the collection will be of type DataTable and it may contain a no.of columns.I can do it with WPF DataGrid but i want to achieve this with WPF ListView and I want to Achieve this w...

How to make WPF resource styles switchable at runtime?

I've got style resources in WPF working so that in my App.xaml I can define whether the customer or administrator layout is used. This works nicely by getting all the style out of the main XAML in a HTML/CSS-like fashion. Now how do I make this dynamic so that I can click on a button in my application and switch the layout between cust...

ListItem Mouse Enter Message Box

Hi, I am using event triggers in my XAML, I have the following style set on a ListItem. What I want is to display the contents of the ListItem in a message box when the mouse enters a list item. <Style.Triggers> <EventTrigger RoutedEvent="Mouse.MouseEnter"> </EventTrigger> </Style.Triggers> I ...

MVVM WPF - Usage of Viewmodels

Hi Guys, I am having a WPF dataentry form which has got 3 comboboxes which needs to be filled with Master Details like Department, Job Title and Pay Type & other information. All these 3 master information needs to be fetched from the database. I am using LINQ to SQL as my data layer. I have already built the maintenance pages for these...

Binding and Layout relation in WPF

While investigating an issue with application I'm working on, I've came across one behavior I don't quite understand. It seems that when you have a TextBox (for example) with bound Text property the system takes one more layout pass than when you have a static Text. Could anyone, please, explain why this extra pass is happening? Does th...

How can I animate a control so that it rolls out like a parchment scroll in WPF?

Does anyone have any idea how one could animate a panel such that it appears to roll down like it is in an old-style parchment scroll in WPF? Any help would be greatly appreciated. ...

WPF DataGridDetailsTemplate expansion bug

I'm using a Datagrid from the WPFtoolkit and am running into a problem with the RowDetailsTemplate. My RowDetailsTemplate contains 3 items: 2 Rich Text Boxes and a button. What I would like to have happen is the button stay docked to the right edge of the window and the two rich text boxes expand to fill the rest of the space. The pro...

How do I get the source of a ContextMenu-originated event in WPF?

Hi I have a TreeView with a ContextMenu with Click events. When the click event in the context menu fires, I get the MenuItem as the source of the event, obviously. How can I get which node in the TreeView was the one who triggered the ContextMenu? ...

Problems closing tabs

I've a WPF app organized with tabs. I added a small button to each tabitem header that allow the user to close the tab. When the user click on the small button, I remove the tabItem from the tabControl. tabControl.Items.Remove(tabItem); As result of this the tabItem dissapears, and that is fine, but here comes the problem: The TabIt...

Silverlight : Custom template for a hierarchy treeview

I am using silverlight and want to dynamically generate a hierararchy tree in the following format : Since Silverlight controls are lookless,how can I structure a template that ultimately look like the image? ...

Enabling Scrollbar in WPF

I'm having a problem right now where my WPF application hides anything below the fold when the window is too small vertically. How can I use XAML to get a vertical scrollbar to appear for the entire app so the user can scroll to see the rest of the content? ...

Updating Custom Attached Property in Style Trigger with Setter

Hi All, I was trying out attached properties and style triggers hoping to learn more about it. I wrote a very simple WPF windows app with an attached property: public static readonly DependencyProperty SomethingProperty = DependencyProperty.RegisterAttached( "Something", typeof(int), typeof(Wind...

How do I load a xaml file without creating the outer object?

Is it possible to load a xaml file from disk (ie not from an application resource) and create the object tree without creating the outer object? In other words, I want to create a class that derives from Window and loads a xaml file from disk. It seems I can either create a class that does not derive from Window and can load from disk, o...

WPF: Nested MenuItems in a ToolBar

Hi. I am working on some XAML for a wpf application and I am having some trouble getting it to do what I want. Here is a sample of my XAML: <!-- Tool Bar Tray --> <ToolBarTray Name="toolBarTray1" DockPanel.Dock="Top"> <!-- File And Edit Tools --> <ToolBar Name="toolBar1" Band="1" BandIndex="1"> <!-- Regular Items --> ...

How to read values from Gridview columns controls in WPF

hi frnds, I am using a WPF application, in which i placed a listview control which has 3 gridview columns. First Gridview column has a label Control and the remaining 2 gridview columns has textbox control. Now my problem is if the user enters a value in the first Gridview textbox column, the second gridview textbox column should be up...

Is there a way to bind To / From property of a DoubleAnimation inside a storyboard to an element inside the CotrolTemplate in XAML markup?

Hi friends, Is there a way to bind To / From property of a DoubleAnimation inside a storyboard to an element inside the CotrolTemplate in XAML markup? Something like this: <ControlTemplate TargetType="{x:Type Expander}"> <DockPanel> <ContentPresenter x:Name="ExpandSite" Height="140" DockPanel.Dock="Bottom"/> </DockPa...

Scrolling a listbox with page up/down

I had an ItemsControl, which you could use page up/down buttons to scroll expectedly. I switched it with a ListBox, to apply (thru triggers) a new DataTemplate when an item is selected. Everything works fine, until using pageup or pagedown buttons. Instead of scrolling one page, it scrolls till the end or the beginning. My previous a...