wpf

Custom button template in WPF

I want to create a simple button template with an image and text inside it. But I want to keep the System button's look and feel. How do I create it, step by step? P.S.: I have already tried it with CustomControl in WPF and BasedOn property. ...

Resolution Free Application

What is meant by the Resolution free application, As I have discussed it with many of my friend and they says that resolution free mean what ever resolution user want to see an application it should adjust it position, the resolultion is monitor resolution or any say 100 by 100 what is resolution? ...

For eBook which control i should use and how to start

Hi , i want to develop such an application through which i can read book ,currently i am using the Richtextbox in flow document,i dont want to use the scroll ,i prefer the navigation style i.e prev page next page start and end ,book may contains images tables so and so ,and how do i import books in my application How can i achieve? ...

Saving an Image from WPF's WebBrowser control - how do you do it??

Hi, everyone. There's probably a simple solution to this but I can't seem to find one. I'm playing around with the WebBrowser control in WPF that ships with Visual Studio 2010 and am trying to save an image that might appear on a webpage to disk programmatically. Many thanks in advance! Luck ...

WPF - TextBlock - Cannot override OnRender

Hi, I am creating a custom control by deriving TextBlock, my intention is to do some custom rendering based on some dependency properties. However the OnRender method is sealed on TextBlock. Although I can get my work done by overriding OnRenderSizeChanged, this is not correct. Any ideas on how can i do it the right way? Thanks in adva...

WPF - Which one is better? Style or User Control?

I wanted to know which one amongst Style and UserControl would be better to use in WPF? For example: I have created an image button in two different ways. One uses Style and ContentTemplate property is set. It uses one other class with dependency properties. The other way is I have created a UserControl which has a button and its cont...

The benefits and hassles of moving entirely to a WPF Project

Hi, I have a project that i started as a WinForms application as that was the format i was confortable with at the time. I have since started dabbling in WPF an introduced some WPF UserControls (mainly grids) into my project and absolutely love them. The question i have is, is there any real advantage to me changing the UI Project of my...

Run WPF Application from another assembly

I want to run my wpf application "A" from another assembly "B". I use the following code: static void main() { var app = new A.App(); app.InitializeComponent(); app.Run(); } when i run my app I got the following error: Cannot convert string '/Resources/icon.gif' in attribute 'Icon' to object of type 'System.Windows.Media.Imag...

how to create event handler for dynamic menu in WPF

Hi, I am beginner to WPF. I create the menu from database tables using following code.... Now i have struck in how to call corresponding windows when clicking menu items? Please its urgent one... help private void Window_Loaded(object sender, RoutedEventArgs e) { mymenu...

WPF - Making selected listview column editable on button click

I have a listView with a gridview presentation and TextBlocks in each column. I would like to make the selected line editable by replacing the textblocks with TextBoxes and ComboBoxes when the user clicks on an edit button. I tried to do this by setting styles that toggles the visibility of the controls like this : <Style x:Name="ItemDi...

Write physical table to csv file

Hi, I was wondering if anyone knows how to write an actual table/grid to a csv file....i dont mean the content of the table/grid, i mean the actual grid lines etc etc, headers, axis..... Thanks greatly in advance. U. ...

Customize WPF databinding: How to add custom logic?

Hi, i have a question regarding some complex data-binding. I want to be able to update a grid (which has the property "IsItemsHost" set to true) dynamically whenever a data-binding occurs. Actually i am using a CustomControl which is an ItemsControl and this has the Grid in its ControlTemplate. To be more specific, i bind the grid to ...

WPF Label vs TextBlock in Border ?

If you know that you have to show tens of texts with a border, would you decide for a Label (which is much complex and resources consuming) or a TextBlock in a Border? . The performance aspect is the one interesting for me now. Thank you ! ...

ListBox SelectedItems Binding

I want to bind Listbox selectedItems to array. But .NET throw exceprion in runtime. d.SetBinding(ListBox.SelectedItemsProperty, new Binding { Source = SomeArray }); Where "d" some ListBox from XAML. Exception: Selected Item cannot be bound. Why? ...

Finding the TextBlock that is part of the default control template ComboBox generated through code.

I'm trying to find the TextBlock that is inside the control template of a comboBox. using VisualTreeHelpar.GetChildrenCount is working only if the comboBox is declared in XAML.In that case GetChildrenCount returns 1 and a recursive search is possible. However, if I declare the combo as a member of the Window class using code, allocated...

Converters on child bindings in a MultiBinding

Suppose I have this MultiBinding: <MultiBinding Converter="{StaticResource FooBarConverter}> <Binding Path="Foo" Converter="{StaticResource FooConverter}" /> <Binding Path="Bar" Converter="{StaticResource BarConverter}" /> </MultiBinding> This doesn't seem to work: the values array passed to FooBarConverter contains DependencyProp...

Fill WPF listbox with string array

Instead of adding each item one by one to the ListBox destinationList from the string array m_List like this: foreach (object name in m_List) { destinationList.Items.Add((string)name); } Is there any better way I can do it? I don't want to bind the data to the destinationList since I want to delete some entries from the ListBox l...

WPF global styles problem with .Net4

I have just changed my WPF application from .Net3.5 to .Net4. Doing this caused all my global styles to stop working. Only the styles explicitly set using a key did work. I've done some research and figured out what causes this, and reproduced it in a simple app. I have a simple WPF app containing only a button with text - no style or ...

WPF Background setting failed

Hello everyone, Here is a code. var image = new BitmapImage(new Uri(@"pack://application:,,,/Images/background.png", UriKind.RelativeOrAbsolute)); var backgroundBrush = new ImageBrush() { ImageSource = image, Viewport = new Rect(0, 0, image.PixelWidth / ActualWidth, image.PixelHeight / ActualHeight), ...

Smooth models in Wpf

I created MeshGeometry3D mesh in wpf. How can i display it smooth? I need something like that: http://www.forman.free-online.co.uk/images/smoothshading.png ...