wpf

Datagrid column Sorting generating error

I have a datagrid column whose column values are databinded. I have used DataGridTemplateColumn and i need to use the sorting in this column. my:DataGridTemplateColumn SortMemberPath="FileName" Header="Name" IsReadOnly="True" MinWidth="150" It works and sort the the data but when i edit the data after sorting, i need to re-generate the...

Smart table drag and drop WPF C#

Hi I am trying to add a drag and drop behaviour for a textblock in a smart table application. I used a window in order to mimic the textblock i wanted to drag. The problem is that on the emulator on my PC the drag works, but on the table it doesn't. From what i could figure out this is due to the fact that on the table the object (the ...

Adding Scrollviewer in StackPanel

How can i add scrollviewer in stackpanel dynamically, Stackpanel already contain a child element dynamically ...

Make child window always on top of parent window

Hello, I'm writing in wpf. In my viewModel I have a command that opens new window. However sometimes this child window is placed under the parent window. (if for instance I work in my application, then open browser and want to return to my application). Window is opened as follows: MyViewModel vm = new MyViewModel(oper); Mywindow wind...

ListView selection problem - Caching prevents selection of many items

Hi. I have a problem with the way a ListView selects its items. I have a ListView bound to an ObservableCollection of items which have a 'Selected' property. I have bound the selection state like this: <ListView.ItemContainerStyle> <Style TargetType="{x:Type ListViewItem}"> <Setter Property="IsSelected" Value="{Binding P...

How to make a bind datetimepicker

I am using wpf framework 3.5 for this I had to use winworms -> datetimepicker. I need to do Binding on the Text <wfi:WindowsFormsHost > <wf:DateTimePicker Format="Short" Text="{Binding date, Converter={StaticResource conkey}}" x:Name="p_datePicker" /> </wfi:WindowsFormsHost> EDIT: Answer: The need to use WPF toolKit DatePicker an...

Text content in a WPF button not being centred vertically

Is there a reason why the text content of a WPF button is appearing with unwanted space above the text? I have a button in a StackPanel. This button is a simple close button so I want it to appear as a square button with an "x" centred in it. I have set my padding to zero and set both the HorizontalContentAlign and VerticalContentAlig...

Wake System from Sleep C#

Hi everyone, I'm trying to add functionality in my program that will allow the user to wake their system from sleep at a set duration. I've googled a lot about this and the examples online don't seem to work. I've used WaitableTimer set the system to go to sleep but it doesn't seem to wake up. Can anyone help me out here. for code r...

How to apply different color schemes in a WPF application

Is there a way to replace all the brush definitions for a WPF application at runtime, and only declare the styles that use it once? This would be useful for different color schemes, but keep the same UI and declare it once. All the examples I can find duplicate the styles in the different theme files - is this the only way to do it? Lit...

Instantiate and reuse instances of objects in XAML

I want to instantiate objects in XAML, and reuse these instances. I think it should be simple but I'm stuck, I'm probably missing something obvious. Say I want to add Cats to different Rooms (Room has an ObservableCollection containing objects of type Cat). In the UserControl.Resources I create ObjectDataProviders: <ObjectDataProvider ...

WPF ListView non integral scrolling

How do I turn off the integral scrolling in a WPF ListView? By default, scrolling a ListView jumps down so I must scroll a whole item at a time. I would like to scroll half way, quarter way, etc. ...

Passing a value along from a Button in a WPF ListView

I have a collection that I am displaying in a WPF Listview. I will have an edit button in each row and need to pass an ID to another control on the screen when that's clicked. I'm not going to be editing in place so I'm not using the Gridview. How do I pass this ID to my other control? Currently my XAML looks like this. <ListView Na...

Hook into the moment when the Collection is filled and removing then the Loading Adorner?

Hello, I am grouping data in a WPF DataGrid. that takes very long so I want to show a Loading bar/adorner. I am using MVVM. How would you remove/fade out the loading bar/adorner when the datagrid has finished the grouping. How do I get the moment when the Data is grouped 100% ? Can this somehow be set in xaml or retrieved etc... ? ...

Call DLL Methods from outside the project / Load Dynamic WPF in aspx

Dear All Experts, for my project, i created a solution with a one aspx page and all of other components are Dynamic load WebUserControls ascx, each user control and related functions are a separate webapplication project. now i need to use WPF with my project, i dont know how to load the ".xbap" file Dynamically in my page, also when ...

WPF DataGrid: Can I cancel a change selection action?

Currently I'm catching the SelectionChanged event, but I would prefer to catch an eariler event that will allow me to cancel the selection change. Background: I have two data grids, the lower being a detail of the upper. When the upper changes, I currently prompt the user to save changes. But if there are validation errors, I want to o...

control in ListView.GridViewColumn alignment

Hi, I have following WPF ListView: <ListView Grid.Column="2" Grid.Row="1" Margin="0,53,12,6" Name="lvwProperties" ItemsSource="{Binding Path=SelectedPropertyItems, Mode=TwoWay}" Grid.ColumnSpan="2"> <ListView.View > <GridView> <GridViewColumn Header="Property" DisplayM...

WPF DataGrid: How do I change the selected row programatically?

How do I change the selected row programatically? I change change the selected item and cell, but I cannot figure out how to get the whole row highlighted. Note: The highlighting works fine when a user selects a row with mouse or keyboard. ...

WPF MenuItem with Image and IsCheckable set

I've noticed that if you set IsCheckable and have an image for a MenuItem, when the item is checked, the image goes away. Is is possible to get it to work similarly to the old .Net 2.0 so that when it's checked, the image has a border around it? Thanks Paul. ...

WPF error CS0433

Hi, I'm getting this error in my WPF application. I get this error not always. If I make Clean and then Rebuild everything is ok. SGEN (0,0): error: Unable to generate a temporary class (result=1). SGEN (0,0): errorCS0433: The type 'XamlGeneratedNamespace.GeneratedInternalTypeHelper' exists...

AdornerElementPlaceholder problem

I have a minor problem with the Textbox Style below - with the Validation.ErrorTemplate to be precise. I want the error image that's displayed to the right of the textbox, be really located right of the textbox (which has to shrink horizontally for that) and not within like it is now. Any suggestions? <Style TargetType="{x:Type TextBox}...