wpf

TextBox - binding property doesn't refresh itself

Hi I have a textbox which Text property is bound like that <TextBox Name="txtBox"> <TextBox.Text> <Binding Path="Data"> </Binding> </TextBox.Text> </TextBox> The filed Data can be changed in various places in my program. However if I change filed Data in ahother control, the t txtBox Tex...

Hide legend of WPF Toolkit chart with more than one data series.

I am trying to use charts from the WPF Toolkit (with LineSeries) and I don't want a legend at all. I need this since I have 10 such charts each with data from a different source and I would like to draw one legend for all 10, to save screen real estate. By default the legend appears the moment you add a second LineSeries. Is there any...

Efficient byte[] to BitmapImage and vice versa conversion in C#.

Hi there, I need to get the BitmapImage from the byte array. Currently I'm working with MemoryStream (byte[] -> MemoryStream -> BitmapImage) but it seems to be not efficient. The same situation in the other way round - I need to get the byte array representing the BitmapFrame. Again, I'm doing that with MemoryStream. What is the most...

WPF - New up presenter when application starts

I am new to WPF. In winforms I used to create a presenter and new it up in the static main(). The presenter's constructor would be given a reference to to the main form before the form would be shown. MainPresenter presenter = new MainPresenter(myform); Application.Start(myform); How can I do this in WPF? I noticed that App.xaml has a...

Change margin around plot area and title in WPF Toolkit chart

I am using the Chart control of WPF Toolkit February 2010 release. The chart takes up lots of space relative to the plot area. How do I control the margin around the plot area and title of the chart. This way, I can arrange the 10 charts I need in a grid without having to use so much space on the screen. Thanks, sprite. ...

Need to add text to rectangle

I am creating Dynamic Rectangle and adding into StackPanel. I need to add text to each rectangle. How can I do that? ...

Binding in Label.ContentTemplate

In the Xaml below, the first control (the TextBlock by itself) has no problem binding and rendering the value of RecordCount. But in the second control (the Label with the ContentTemplate), the value of RecordCount is not rendered. However, the literal "Cars" is rendered fine. So I know the ContentTemplate is working, but the binding ...

Custom styled listbox - how can I keep the style for a selected item?

I have a styled listbox. Listbox items change color when hovered over and when selected. Hover and select work fine. But when selecting an item then taking the mouse off it and coming back to hover over it causes it to go back to hover/unselected state even though it is still selected. How can I keep the listboxitem in a "selected" visua...

WPF/XAML Databinding Question

Hello, I am writing an application in C#/WPF and am trying to figure out how to databind the width of the grids column definitions to a fraction of the screen width. Is this possible? Essentially I want something like this: Grid = 2x2 Row 1 Height = 2/3 of screen height Row 2 Height = 1/3 of screen height Row 1 Width = 2/3 of screen wid...

Prism and MVVM for new WPF project

I will be starting a new project soon and am looking for some architectural advice from those of you who have experience with WPF, Prism, and MVVM. The project will definitely be WPF and I will be implementing MVVM (I will likely use Josh Smith's MVVM Foundation as a starting point) in order to be able to benefit from the separation of ...

How to implement OAuth2 provider and consumer in C# .NET

I have been doing a bit of searching around on oauth2 and think it may be a good fit for some WCF rest services I am building out that will be consumed by some WPF apps and MVC web apps. The idea would be that the user is initially asked to login with their username / password and receives an access token which gives them access to the a...

Linq query to treeview HierarchicalDataTemplate

First, sorry for my bad english. I have an EF entity that looks like: class Item { public Guid Id { get; set; } public string Title{ get; set; } public Guid? ParentId { get; set; } public ICollection<Item> Items { get; set; } } Now i want to load the data from that entity on a treeview... the best I could get is...

Alternatives to WebBrowser control in WPF?

Hi, We are working on a WPF app with the web browser control. When the user drags the window, the web browser lags behind the window as it drags. Does anyone know how to solve this issue? Failing that, does anyone know an alternative to the web browser control itself? Thanks! ...

Wpf- How can I get the TreeViewItem that triggered the TreeViewItem.Loaded event?

I am trying to attach some handlers to each TreeViewItem as they are loaded and then remove the handlers as they are unloaded. Here is the Code that I have in my custom control which inherits from TreeView: public ModdedTreeView() { this.AddHandler(TreeViewItem.LoadedEvent, new RoutedEventHandler(ItemLoaded)); ...

speed dial like feature in WPF

Hi, I want to create a speed dial feature in WPF. I have seen that feature in browsers. where multiple page images are shown. The user can click on the pages to go to that page. I searched in Google and found that i can do this using RenderTargetBitmap. Basically i am trying to create the image of the screen using RenderTargetBitmap an...

How to wait for all storyboards on a control to finish?

I have created a custom control which has a style defined for it in themes/generic.xaml. The control defines some additional RoutedEvents. For these events the style, or any style that overrides it, could define EventTriggers that start a storyboard. When i raise a RoutedEvent from my control, how can i wait for all of these storyboards...

How to implement Bounding Box(Multiple selection of objects) and grouping as implemented in Photoshop using WPF( using SVG/PVG) /Winforms?

Hello Everybody, I am working on WPF with SVG,PVG(these are the format used ofr WPF, not using XAML) for a Publishing application. I want to implement the multiselect of different objects and scaling to them and also grouping them and implementing rotating and moving and sacling the objects as group . I want the exact/some pont near to...

Problem with Entity Framework in WPF Application

Hello again, I am having a problem with a SQL server database in my WPF application. The database is in a separate class library project and I am using Entity Framework. The problem arises when I try and deploy this using ClickOnce in which the following error occurs: "Underlying Provider failed to open" I tried to solve this by moving ...

How to draw arrows on a customized TreeView?

I have a customized TreeView which displays its content in form of hierarchical boxes inside a WrapPanel (based on http://www.codeproject.com/KB/WPF/AdvancedCustomTreeViewLyt.aspx). I only modified the template of the TreeView. Now, I need the following: I would like to freely position my nodes: Would you recommend to replace my WrapP...

What is the recommended WPF application project structure?

Hi I am quite new to WPF. I like the MVVM (Model-View-ViewModel) pattern. My current project has the following type of file/namespace structure: Clients Controls ClientNameControl.xaml ClientSurnameControl.xaml Views ClientCapture.xaml Models Client.cs ViewModels ClientViewModel.cs And ...