wpf

Print flowDocument block on differnt pages

I am printing a FlowDocument using flowing Code PrintDialog dialog = new PrintDialog(); var value = dialog.ShowDialog(); if (value.HasValue && value.Value == true) { XpsDocumentWriter writer = PrintQueue.CreateXpsDocumentWriter(dialog.PrintQueue); PageImageableArea imageArea =...

How to make button's width autofit the text of a button?

I am currently doing this, but I am doing something wrong :): <Style TargetType="{x:Type Button}"> <Setter Property="MinWidth" Value="90" /> <Setter Property="Width" Value="Auto" /> </Style> I want the buttons to have some minimum width but also to have their width expand to fit the text of the button. ...

Blend DesignTime Data with d:IsDataSource

It seems that d:IsDataSource can be used to provide design time data in blend. Does anyone know where I can find the docs for this or can explain how the behavior and usage of this Property is? I have only seen it beeing used in a ObjectDataProvider. Whereesle can I use it and what does blend acutally do when it finds this property in a ...

What is the difference between ItemTemplate and ItemPanelTemplate?

In WPF Listbox, I'm confused with this 2 notions : ItemTemplate and ItemPanelTemplate Can someone explain me more ? Thanks John ...

What framework for MVVM should I use?

I am developing an application with the MVVM model, but I have reached a point where I need to choose which framework to use. Among the possible options are: MVVM Toolkit MVVM Foundation WPF Application Framework (WAF) Light MVVM Caliburn Cinch Prism In your experience, which is better? ...

ListBox content not completely stretching across listbox

I am trying to make a list box where I have complete control over the look of each item in the list box. I can make the item horizontally stretch. However, there's this thin sliver of blue to the left of a selected item. (In the picture, the middle item is selected). Can I make this blue strip go away? Here's the complete code. <Wi...

Identify the Operating System details in C#

How can I get the OS details using C# code in my WPF application? ...

WPF Listbox - change itemsource of control in datatemplate

I have a listbox with a datatemplate that holds a number of controls bound to my collection. What i want is to change the itemsource for one of these comboboxes dependant upon the value selected in one of the other comboboxes in the same row. I don't want to change the itemsource for all corresponding comboboxes within the rest of the r...

WPF ItemsControl - Command on ViewModel not firing from within ItemsControl

Hi, I'm using M-V-VM and have a command on my ViewModel called 'EntitySelectedCommand'. I've trying to get all the Items in an ItemsControl to fire this command, however it's not working. I think it's because each items 'datacontext' is the individual object the item is bound to, rather than the ViewModel? Can anyone point me in the ...

Adding a WPF User Control from Code Behind

I have a UserControl that I want to add at runtime to my current WPF Page. Is this possible? Having a Menu-bar and under it i want to have all my information, i.e. that i select Menu -> Show Orders then I want the OrderList-UserControl to be added under the Menu. Sure I could use a Order WPF Page for that but then I'd have to re-create...

WPF Multiple master/details, same grid

Hi I have a tree view which has three levels. Lets say its a league, division and team treeview. Now, when I select each of the items in the tree, I would like to see detailed information about it. Whats the best way to achieve this? Since Grid doesn't items (like a ListBox), I can't just set its ItemsSource and make a DataTemplate....

WPF: UI Composition

I am working on a WPF app and the UI is getting a bit complex to manage. I am looking for advice on how to maintain it as it grows. The layout looks something like this <Grid> <List of Objects View/> <Objects Relationship View/> <Object Details View /> <Multiple Objects Details View/> <View 5 /> <View 6 /> : ...

Wpf Binding filteration

Hi , I have a doubt binding a textbox.he scenario is like this.I hava a dataset say, DataTable dt=new DataTable(); dt.TableName = "table"; dt.Columns.Add("mode", typeof(int)); dt.Columns.Add("value", typeof(int)); DataRow dr = dt.NewRow(); dr["mode"] = 1; dr["value"] = 1000; dt.Rows.Add(dr); dr = dt.NewRow(); dr["mode"] = 2; dr["value"]...

Equivalent of WinForms TextBox.Validating event in WPF

In WinForms I could handle the Validated event to do something after the user changed text in a TextBox. Unlike TextChanged, Validated didn't fire for every character change; it only fired when the user was done. Is there anything in WPF I can use to get the same result, an event raised only after the user is done changing the text? ...

WPF RichTextBox scrolling

The richtextbox component in my WPF app is populated using a FlowDocument and the RTB's "Document" property. rtb.ScrollToEnd(); doesn't seem to do anything, and i've even tried calling BringIntoView() on the last "row" added to the table that structures my FlowDocument. Any Suggestions? Thanks! ...

WPF Document GridView

Hello, is it possible to use a GridView in a flow document? I'd need to be able to change the color of the header, perhaps even change the color of alternate rows. I've never used Documents before, but before jumping in, I need to know if this is possible; if not I'll have to look for a different solution. Thanks in advance. ...

get all wpf controls in cs file and check their type

Hi, I have some xam controls on wpf form. i want to count the control, how much controls on the form? in cs file and also check their type either control is text box or combo box or etc. plz help, its urgent ...

WPF: Simple Binding Q: binding visibility to control in different class

Hello, In my main window xaml I have two user controls and two radiobuttons. I want the radiobuttons to control the visibility of the user controls. xaml excerpt: <WpfApp2:ViewTree/> <WpfApp2:ViewTab/> <RadioButton x:Name="radioButton_Tree" GroupName="View" IsChecked="True"> Tree View </RadioButton> ...

How can I keep my WPF UI responsive while communicating with server on an other thread?

I have a wcf client that before doing some complicated interactions with the wcf service does a simple check for the service to be alive. As the time-out for a failed connection is one minute, I want to implement this check asynchronously. This is what I have: //Method on the main UI thread public void DoSomeComplicatedInteraction() { ...

WPF: MVVM & Editing Hierarchical Data

I'm still trying to wrap my head around MVVM. Let's say I have a Model that looks something like this: public class Company { public IList<Division> Divisions { get;set;} } public class Division { public string Name { get;set;} public IList<Department> Departments { get;set} } public class Department { pub...