wpf

Problem using Blend 3 Interaction.Behaviours in VS2010

There seems to be a problem with support for the Interactivity namespace of Blend 3 in the VS2010 xaml editor. I have the following installed: VS2010 Blend 3 + Blend 3 SDK I am trying to compile a demo project that is targeted at .Net 4 Client Profile and has a reference to System.Windows.Interactivity (in the Blend 3 folder). In th...

Dispalying pools depending od parameter in wpf treeview

Hi, I've got a wpf treeview control and depending on parameter in constructor, I want to display pool NumberOfHotels or not display. <Grid> <StackPanel Name="stackPanel1"> <GroupBox Header="Wybierz" Height="354" Name="groupBox1" Width="Auto"> <TreeView Nam...

Update observable collection by requerying or adding to collection?

I have a observable collection exposed as a property within a view model. The observable collection is loaded with objects from a data access layer (linq2sql). When a new item is added to the database through another view model what is the best way to update the observable collection? Should I repopulate the observable collection with a...

WPF: Binding to commands in code behind

Hi, I have an WPF Microsoft Surface Applikation and I'm using MVVM-Pattern. I have some buttons that are created in code behind. And I would like to bind commands to them but I only know how that works in the XAML like this: <Custom:SurfaceButton Command="{Binding SaveReservationCommandBinding, Mode=OneWay}"/> But I cannot do it l...

Scroll a ListBox's VirtualizingStackPanel with buttons

I have a Listbox displaying 5 items at a time, horizontally. I want to implement a 'Previous' and 'Next' button that when clicked, will display the previous set of 5, or next set of 5 items. I am not displaying the horizontal scroll bar, as I don't want a user to navigate with that. Is there already some functionality implemented so I...

How do you set the thickness of the horizontal gridlines in the WPF toolkit datagrid control ?

I am using the WPF toolkit datagrid to display some data and want to increase the thickness of the horizontal girdlines for each row, I would have thought this would be a simple thing to do but i can't find solution. ...

Using GetLineStartPosition to get the end of a line in WPF RichTextBox.

A bit of background. I would like to be able to process text for the line that the caret is on in a WPF RichTextBox. Please see my earlier question about the TextPointer class: http://stackoverflow.com/questions/3046162/how-to-keep-track-of-textpointer-in-wpf-richtextbox. I know how to get the TextPointer at the start of the current lin...

System.Windows.Media.RenderCapability.Tier returns not the render mode

I use System.Windows.Media.RenderCapability.Tier to show the current render mode within a diagnostics panel of my app. If I force the app (3.5sp1) to change the render-mode through the following code HwndSource hwndSource = PresentationSource.FromVisual(visual) as System.Windows.Interop.HwndSource; HwndTarget hwndTarget = hwndSource.Co...

Showing multiple models in a single ListView

I've three models (Contacts, Notes, Reminders). I want to search all these and produce the filtered result in a single listview and depending upon the selection I've to display the corresponding view(UserControl) to its right. I want the right way of implementing the design or atleast alternatives to this method that I've tried. Now I'...

Hyperlink and targetname in wpf

Hi All, I want to display the pages in the frame by using the hyperlink control. but it is not working. Code: <Window x:Class="WPFNavigation.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="400" Width="500"> <Grid> <Grid.Colum...

Need to trigger an event when ListBoxItem is clicked in ControlTemplate

I'm overriding the styles of my ListBoxItems with a ControlTemplate, however by doing that, I lost the handler for my ListBoxItem click event. I found a post that was helpful in saying I need to add an event handler in the ControlTemplate, but I don't know how to do this. Any help & direction on doing this is greatly appreciated! ...

How to remove blank space from marquee list’s first item and last item?

Hi all, I am using horizontal list view in marquee list. Which is keep moving from right to left. My code is : double height = canMain.ActualHeight - marqueeList.ActualHeight; marqueeList.Margin = new Thickness(0, 0, 0, 0); doubleAnimation.From = -marqueeList.ActualWidth; doubleAnimation.To = canMain.Ac...

Childwindows in MVVM

Hi I'm having a problem understanding something about MVVM. My application relies on dialogs for certain things. The question is, where should these childwindows originate from? According to MVVM, viewmodels should contain only businesslogic and have zero actual knowledge about UI. However, what other place should I call my childwindows...

ScrollBars are not visible after changing positions of controls inside a Canvas

Hi, I created a custom canvas control inheriting from WPF Canvas. I am using it like this in main window - <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"> <RTD:RTDesignerCanvas Margin="5" Background="White" x:Name="canvas1" Focusable="True" Allow...

Paste Event in a WPF TextBox

I have created a custom control inheriting TextBox. This custom control is a numeric TextBox, only supporting numbers. I am using OnPreviewTextInput to check each new character being typed to see if the character is a valid input. This works great. However, if I paste the text into the TextBox, OnPreviewTextInput is not fired. What is ...

Modal dialog focus problems on WPF application

Hi, I have a problem with my wpf application where a modal dialog will appear behind the main application causing it to hang. It is very inconsistent, where most of the time the pop-up works correctly and is shown in front but occasionally it will pop-up behind, which stops any interaction with it. I can still close the dialog using t...

Best way to attach row from datagrid to EF.

Using MVVM and EF...I have a datagrid binding to a View Model (using ObservableCollection). The view model has a save command which simply calls the SaveChanges command of the Data Context. However, when a user adds a new row to the datagrid, the new entity is detached. Is there any easy way to automatically attach it when it gets cre...

wpf observableCollection

I have an ObservableCollection which is dataContext for my treeview when I try to remove an Item from ObservableCollection I will get an error that Object reference not set to an instance of an object . can you please tell me why this error is happening and what is the solution thanks EDIT 1: The code is something like : class MyClass...

Handling thousands of object in Entity Framework 4 : any grid ?

Hi I have a DB with 50 000 records mapped to EF 4 classes. I have not found any WPF grid capable to correctly handle EF object correctly (lazy loading, filtering....) Does anyone has some experience with such figures with EF ? which grid have you been using ? Thanks Jonathan ...

WPF DataGrid : CanContentScroll property causing odd behavior

i have a solution where i generate a DataGrid (or multiple instances) based on user criteria.. each grid keeps receiving data as it comes in via ObservableCollection the problem i had, was that the scroll acted weird. It was choppy, and scrollbar would resize it self while scrolling. than i found.. CanContentScroll property! It comple...