wpf

Would this architecture strategy work for a business application written in F#?

I've been considering how you would write a business application in only F# with WPF. Here's my thinking of a general outline of how to go about it, but I'm looking for whether or not it will work: Start with ADO.NET Entities to automatically generate a data access layer. Since F# doesn't support partial classes, use F# Extension Meth...

treeview Multibinding in wpf

I want to bind a treeview to a class like this one: public class Folder : Base_FileFolder { public Folder() { Folders = new ObservableCollection<Folder>(); Files = new ObservableCollection<File>(); } public ObservableCollection<Folder> Folders { get; set; } public ObservableCollection<File> Files { ge...

Performance problems with displaying a WinForm dialog from WPF application.

I am currently developing a WPF application that will utilize existing WinForm dialogs. I'm experiencing a long lag between the time I call ShowDialog() on a WinForm to the time it is displayed. Even when reusing WinForm dialog objects the lag time is nearly as bad on the second hit. Meaning that the problem isn’t in the constructor. D...

WPF, 'Object reference not set to an instance of an object' in Designer

I'm getting an "Object reference not set to an instance of an object" error when I try to reload the Designer for my XAML UserControl. Visual Studio highlights the following line as being the problem: <local:TemplateDetail Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3" Width="600" TemplateData="{Binding ElementName=cbo_templates,...

WPF - How to set Grid's children in a style?

How can I do something like this? <Style TargetType="Grid"> <Setter Property="Children"> <Setter.Value> ... </Setter.Value> </Setter> </Style> I know Children in read-only and this gives me "Writable property expected" on Children. Thanks ...

Only print first frame of TIFF image when print to XPS printer and memory leak when print to CutePDF

Hi all, I'm developing the ImageViewer by using WPF as follow: I have a TIFF (multiple pages) binary in database and decoded by TiffBitmapDecoder with Cache option = Default. After decoding I get a list of Frames (pages) Each frame (represent one page of the Tiff file) is used to construct an ImageBrush to set to background of a canva...

WPF iterate through items in a listview

I have a ListView with a CheckBox as one of the columns, bound to a boolean property of a custom object. I'm trying to figure out how to iterate through the items in the ListView and check all the checkboxes. What I have so far is below: XAML: <ListView x:Name="MyListView" DockPanel.Dock="Top" Height="275" IsSynchronizedWithCurrentIt...

Width of items in ItemsControl

I have an ItemsControl with a DataTemplate that is bound to an ObservableCollection of integers. <ItemsControl Name="DimsContainer" ItemTemplate="{StaticResource DimensionsTemplate}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <StackPanel Orientation="Horizontal"/> </ItemsPanelTemplate> </ItemsCont...

EditingCommands of the WPF RichTextBox loose its binding when they are not put within a ToolBar

Using the below code in a DataGridTemplateColumn of the DataGrid, my formatting buttons are disabled(grayed out). The formatting buttons are only enabled when they are put in a ToolBar. When the buttons are put in a ToolBar I do not need the CommandTarget. So when I put them outside a ToolBar some could think it must work with CommandTa...

Streaming or Embedding Rich Media in a WPF FlowDocument

While I don't have a specific code example in mind when writing this, I do wonder if anyone in the community has worked with rich media in relationship to WPF FlowDocuments. Specifically, I would like to be able to reference a video within a FlowDocument, and that video may or may not be short enough to justify directly downloading as a...

ItemsControl Drag and Drop

I have an ItemsControl with a DataTemplate that is bound to an ObservableCollection of integers. <ItemsControl Name="DimsContainer" ItemTemplate="{StaticResource DimensionsTemplate}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <StackPanel Orientation="Horizontal"/> </ItemsPanelTemplate> </ItemsCont...

ListBox with pop-out/popup item details

Hi I would like to create a listbox, with a details pop-up/tooltip kind of window. Scenario is as following: List of items Show details of selected item Details should be displayed outside the listbox and overlaying any controls that happens to be nearby. The problem about using tooltips is that they disappear after a while. And the ...

Localize images in WPF

Hi. I'm building a program in WPF which must feature multi-language support, with the ability to switch language at run-time. My question concerns the image part of the localization. I've built a solution which does not work the way I had hoped it would work and I would like some help fixing these problems. The code posted below is onl...

binding certain items from listbox to combox itemsource

Hi, I have a list box containing many items and I have a combobox in C# WPF. I would like to bind the itemsource of the combobox to that of the listbox but I want to filter out some of the items (it's an xml datasource, I want to filter by the contents of a certain element of the item element). Example item: <Item> <itemtype>A</it...

How to load a UserControl in WPF with reflection?

private void Window_Loaded(object sender, RoutedEventArgs e) { var assm = Assembly.LoadFrom("wpflib.dll"); foreach (var t in assm.GetTypes()) { var i = t.GetInterface("test.ILib"); if (i != null) { var tmp = Activator.CreateInstance(typeof(UserControl)) as UserControl; this.stac...

Markdown for C#/WPF Project (MarkdownSharp)

i did some finding and found theres a project markdown sharp which is used by stack overflow? Open source C# implementation of Markdown processor, as featured on Stack Overflow. so anyway, i downloaded it. but how do i use it? if possible any code samples or tutorials? theres none to get me started in that google code site. ...

Generic.xaml - Referencing styles

If I have a Style inside Generic.xaml and I want to reference a style within the SAME Generic.xaml file why does it not work? <Style TargetType="{x:Type w:SomeControlIWantToStyle}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type w:SomeControlIWantToStyle}"> ...

Windows Phone 7 Styles on Desktop app

I' building an hobby project in WPF also decided to use Metro style theme to application. Is it possible to use Windows phone 7 styles in desktop application instead of recreating? ...

From Web Developer (HTML/CSS) to WPF: How can i start styling my WPF app?

i know HTML/CSS and want to learn WPF styling. how can i get started. i see that padding, for example, works differently in WPF app. in css: padding: 5px 10px; in XAML? Padding="5px" i notice that i need to expand the width of the element eg. button myself to accomodate the padding? if so, how can i calculate the box model? the...

WPF StaticResource works, DynamicResource doesn't

Hi, I have been trying for a day now, to no avail, to create a bunch of brushes in the theme then using them with DynamicResource in a custom control. What I did is this: create the theme generic.xaml which contains styles (works) add a dictionary to merge in generic.xaml to contain brushes used in the application (works) make brushes ...