wpf

using BitmapSource as Image source in WPF

Hello Everyone, I am trying to update an Image (_browserScreenshot below) object in XAML by changing the source image every time an event determines the source needs updating. Right now I have this: public BitmapSource GetScreen() { Bitmap bitmap = new Bitmap(app.Browser.ClientRectangle.Width, app.Browser.ClientRec...

WPF adding Icon to windows cause Property Error

Here is the exact error I got. The favicon.ico has been added in the project as a resource and I have set to "Resource" the Build Action. I found some solution that require to add some code. My question is why I can't do it with the Visual Studio Interface? ...

Wpf Toolkit. Bind DataGrid Column Header to DynamicResource

I'm trying to bind DataColumn Header to DynamicResource using following code. <Window.Resources> <sys:String x:Key="HeaderText">Header Text</sys:String> </Window.Resources> <Grid> <tk:DataGrid> <tk:DataGrid.Columns> <tk:DataGridTextColumn Header="{DynamicResource HeaderText}" Width="100"/> </tk:DataGr...

dynamic datatemplate with valueconverter

I want to show data in a wpftoolkit datagrid where the data is a collection of public class Thing { public string Foo { get; set; } public string Bar { get; set; } public List<Candidate> Candidates { get; set; } } public class Candidate { public string Name { get; set; } public CandidateType CandidateType { get; se...

Silverlight Video Stretching

What I want: To be able to resize the actual video inside the SL player with JS as I drag the corner. What I have so far: http://resopollution.com/granicus/silverlight_test/test_silverlight.html (try dragging the corner, it crops the video, not resizing the video). I'm using jquery to dynamically resize the outer div and the OBJECT tag ...

How do I detect a Lock This Computer command from a WPF application?

Would prefer an answer in C#, .Net 3.5 using WPF (Windows Forms also okay) I have an application that is essentially a toolbar window or tray icon. It needs to detect if a user locks his/her workstation and walks away in order to update the person's status in a centralized system. I can detect a session switch or a logout easily enoug...

How to get sole DockPanel child element to dock on the top

Below I say "DockPanel.Top" on Menu but it docks in the middle. (?) If I take the Height attribute out of Menu it docks on top but is about 200px high. (?) I thought that was what LastChildFill was for. How can I get this child element of DockPanel to dock on the top with no other items in the dockpanel? <Window x:Class="TestContain...

WPF: Is ListBox or Panel responsible for mouse wheel navigation?

I have a custom ListBox which uses a custom Panel as ItemsHost. I want to have control over mouse wheel input, so that turning the wheel changes the single selected item. I believe that the best method to do so is to handle the OnPreviewMouseWheel event (although this is only have what I want since it doesn't provide horizontal wheel da...

Selecting a Textbox Item in a Listbox does not change the selected item of the listbox

I Have a wpf Listbox that display's a list of textboxes. When I click on the Textbox the Listbox selection does not change. I have to click next to the TextBox to select the listbox item. Is there some property I need to set for the Textbox to forward the click event to the Listbox? ...

In WPF, how can a dynamically loaded element access its parent's elements?

In Window1.xaml I have menu and display area: <Menu x:Name="TheMenu" Width="Auto" Height="25" DockPanel.Dock="Top"/> <ItemsControl x:Name="MainContent" DockPanel.Dock="Top"/> In Window1.xaml.cs I dynamically load in a menu item: MenuItem menuItemEmployees = new MenuItemEmployees(this); TheMenu.Items.Add(menuItemEmployees); In MenuI...

Will WPF replace WinForms?

Is WPF expected to replace WinForms in the near future, or is it more of a complimentary technology, intended for applications that have a strong graphical content? Answers that link to statements from Microsoft will be most appreciated! (I looked already, but could not find anything definitive) ...

WPF change brightness

Well i have a application that is black and white and i need a function to lower the brightness how can i do this? all the white comes from a SolidColorBrush that is saved in a ResourceDictionary(Application.xaml), my current solution is to put a empty window that is back with 80% opacity over it but this disenables me to use the underly...

WPF analogy for 'em' unit

What is the WPF analogy for the CSS em unit? ...

Is it possible to use checkable MenuItem as control template for RadioButton?

I have a menu in my WPF application with multiple options which act like radio button group (selecting one deselects rest of them) and I'd like to use checkable menu items as templates for radio buttons. I've tried to set the template but it doesn't seem to work like one would expect. Selecting and unselecting items do not seem to be sy...

In WPF, is it possible to specify multiple routed events for a single event trigger?

I have an event trigger that I want to be fired in response to two different routed events. I don't want to repeat the event response code (in XAML) twice. Can I specify multiple routed events for a single event trigger declaration? Example of a single event: <Style.Triggers> <EventTrigger RoutedEvent="Button.MouseEnter"> ...

How do I run a Full Trust XBAP on intranet?

I've made a WPF Browser Application that hosts old WinForms controls (I haven't migrated fully to WPF yet). Using WindowsFormsHost means my Browser App requires Full Trust to run. This is not a problem for me since this app is only meant to be run on the intranet at my company. However, after I deploy the xbap to a network share, it refu...

Dialog with OK/Cancel behavior in C#/WPF with data binding

In my App class, I have a Collection of objects, like this: (the Collection is in the App class because i need to have access to it application-wide in different windows, etc.) public partial class App : Application { public ObservableCollection<Person> Persons { get; set; } public App() { Persons = new ObservableCollection<Person...

How can I make a rounded-corners form in WPF?

I am trying to make the corners of a Window (WPF) rounded and it doesn't work, I tried to make the window itself transparent and add an internal border with rounded corners and it doesn't work. any ideas? ...

Help Creating a Style for a ListBoxItem

I am new to styles and need help to create a style for a ListBoxItem that will give the item a transparent background then have the Font turn Gold when hovered over. It should not change the color when clicked and return to normal when the mouse moves off. It must still pass the selected object to the PreviewMouseRightButtonDown event ...

In WPF/XAML, should every container control contain a layout control?

When designing WPF application UI's in XAML, should every container-type control contain a layout control to house all children controls? Take a group box, for instance. I can either throw controls onto the group box directly, or I can use a layout control and place the layout control inside of the group box and then controls in that. ...