wpf

Printing a formatted HTML page in C#

I am looking for a way to print a formatted html file in landscape mode in c# (primarily wpf). Print dialog would be nice in order to set the page setting to landscape. I tried using Microsoft's html to xaml converter and it destroyed the formatting. I find it quite amazing that there is no method or grabbing a file and sending direct...

How do I use a WPF DataGrid with multiple types with different properties?

Hi, I can easily get the official DataGrid for WPF to work using an ObservableCollection of objects defined like this: public class Customer : INotifyPropertyChanged { public Customer(int ID, String name) { this.ID = ID; this.name = name; } public string name { get; set; } public int ID { get; se...

How can I read from STDIN in a WPF application

The question is that I have some HID devices that act as a keyboard (MSR, Barcode scaner, RFID reader) and I want to be able to read their input in my WPF application without the necessity for this to happen in say a text field in the application. Is it possible to read from STDIN in a WPF application. calling Console.ReadLine() return...

WPF/Silverlight XAML: How do I bind a SQL bit field to a True/False combobox or listbox?

I store True/False values as bit fields in SQL Server. The fields are nullable. What is the XAML syntax to bind a bit field to a WPF combo box so the user can choose True/False or blank (null)? By the way, I'm binding to a strongly-typed dataset/datatable. Drag and drop binding has simplified binding to other datatypes. I certainly don...

How to obtain the selected item after Listview Binding ?

I have a ListView and it's getting updated every 5 seconds. The problem is that the selected item vanish. How can I obtain it ? ...

RibbonComboBox Text Not Retaining Edits

I have the following xaml in my ui: <ribbon:RibbonGallery SelectedValue="{Binding Text}" SelectedValuePath="Content" SelectedItem="{Binding SelectedRemark, Mode=TwoWay}" MaxColumnCount="1"> <ribbon:RibbonGalleryCategory ItemsSource="{Binding Remarks}" DisplayMemberPat...

WPF ComboBox: how to set focus on it's togglebutton

I'm trying to get a combobox to match a visual design, so its togglebutton has a blue border when the combobox has focus. I can't figure out how to do this and can't find an example. When the combobox gets focus, the textbox inside gets the dashed focus visual. How do I pass the combobox focus state down to the togglebutton, so that it'...

Looking for specific tutorial about WPF and WinForm.

Hello, I remember once I found a nice online tutorial that showed how WPF works through nice exapamle of converting WinForm application into WPF. But I forgot link to it. It was divided into multiple chapters. In first application was converted into WPF using WinForm "mindset" and then using specific technology of WPF (DataBinding, Con...

Ask user before closing C# WPF application

Hello. I want to ask user before closing application. I's C#.NET 4.0 application. I'm using WPF. I can do it in windows forms, but not in WPF. Event is fired when user want to close app, message Box appears, bun no matter which button is pressed(Yes or No) application always closes. Why? Where is mistake? It works, but only when user pr...

Question about Horizontal alignment for WPF Image control

For the WPF Image control, Horizontal alignment doesn't work.. Any ideas? I've pasted the exact code below.. the image appears in the middle.. <Canvas Canvas.Top="550" Canvas.Left="225" Width="500" Height="100"> <Border BorderBrush="#323232" BorderThickness="75" Width="500" Height="100"></Border> <Image Canvas.Left="0" DataContext=...

WPF programs runs in Visual Studio 2010 but not when clicked on exe

Hi, I've made a WPF application that runs perfectly inside Visual Studio 2010. When I built it (debug or release mode) and try to run the app, I've got an error, the form doesn't start. any ideas? thanks Filip ...

WPF listbox copy to clipboard

I am trying to copy a standard WPF listbox selected Item (displayed) text to clipboard on CTRL+C. Is there any simple way to achieve this. If it is something that works for all the listboxes int he app.. that would be great. Thanks in advance. ...

What are the big major drawbacks porting a wpf LOB to silverlight 4

Hello folks, I am thinking about porting my alpha WPF MVVM application to silverlight. I do not use 3D its a LOB ;-) What I promise myself from the conversion is to get more customers in the end (Mac/nix user do not pay well ;P). 1.) At the moment I am using sqlite as database. Is it possible, that I can access the sqlite file on the...

How to create Itemscontrol ItemTemplate in code behind

Does anyone have a walk through/example/blog of how I can dynamically create the item template of an items control in the code behind? I have an object that has a dynamic number of properties and I'm needing to vary the output but I'm having difficulty getting started. I've created a few from XAML but never done it from the code behind...

WPF button problem with style

Hello.. I have to create a custom styled button. The problem is that although i change everything when mouseovering it or when it has focus it gets the original colors! Tried to set FocusVisualStyle="{x:Null}" but it keeps doing it.... <Button Content="Button" Height="143" Margin="85,76,190,0" VerticalAlignment="Top" FocusVisualSty...

WPF set attached event programatically

Can someone explain how you do this programatically in WPF? <window Validation.Error="ItemError"></Window> I am trying to set the attached event for Validation.Error through code, but cannot quite figure out how to do it. ...

WPF Datagrid Row Editing "ENDED" event

I know that WPF datagrid has "RowEditEnding" event , but I need to fire the event on after the Row has comitted to check if the newly added row is duplicated and merge the duplicated row. My datagrid has "CanUserAddRow" property set to True. I am using EntityObservableCollection that extends ObservableCollection to synchronize my entity...

TextBlock Databinding

Hi When I run following code textblock is not changing. My guess is databinding is missing either in code or XMAL. XAML <Window.Resources> <ObjectDataProvider x:Key="PersonObj" ObjectType="{x:Type local:Person}" MethodName="GetFirstName" /> </Window.Resources> <Grid> <!--<TextBlock Margin="26,7,12,...

Map a class in XAML that isn't in a namespace

Yes I know this is considered bad practice, and for the most part I actually agree (i.e. no need to debate that point) but I'm wondering if it's possible to reference in XAML classes that aren't contained within a namespace. In other words, root-level classes. Again, I know this is bad practice, but I am curious. (BTW, yes I know abou...

[C#] Possible to add a marker on the video/time slider in Microsoft Expression Blend?

I want to add a marker on the slider in Microsoft Expression Blend, for example, when I play the whole video (total got 4 different parts), there will be 3 markers on/below/near the video slider to show the user when/where is the next part of the video. Is it possible to do that and how? Thanks. ...