wpf

WPF: LineBreak enable/disable dynamically

i would like to make the LineBreak element inside of that TextBlock controllable by the user in preferences to Enable/Disable it being there <TextBlock Style="{StaticResource TextBlockStyle}" Width="130"> <TextBlock.Inlines> <Run Text="{Binding Path=Name}" FontWeight="Bold" Foreground="#FF2A4D9E" /> <Run Text="{Binding Path=Pric...

wpf: bind to a style property on main window from UserControl

I have a UserControl which has a style, that i would like to be influenced by a settings checkbox on the main window hosting my user control so myControl.xaml has a Style which i would like to have a trigger, that should observe a CheckBox inside MainWindow.xaml i know one way to do this, would be to create a local property in myContr...

Image Viewer application, Image processing with Display Data.

Hello All, I am working on Image Viewer application and planning to build in WPF. My Image size are usually larger than 3000x3500. After searching for week, I got sample code from MSDN. But it is written in ATL COM. So I am planning to work and build the Image viewer as follows: After reading the Image I will scale down to my viewer ...

WPF Button Animation

I have a control template for a button that looks like this: <ControlTemplate x:Key="CopyButton" TargetType="{x:Type Button}"> <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text=">>>>"/> </ControlTemplate> How could I go about animating this so that when the mouse is hovering over the button the > arrows "move...

WPF - Redrawing a Context Menu when Items change?

I have a ItemsControl in a ScrollViewer, and when the items exceed the width of the ScrollViewer they are put into a ContextMenu and shown as a DropDown instead. My problem is that when the Context Menu is first loaded, it saves the saves the size of the Menu and does not redraw when more commands get added/removed. For example, a panel...

Proper way to use Linq with WPF

I'm looking for a good guide into the right method of using Linq to Sql together with WPF. Most guides only go into the bare basics like how to show data from a database but noone I found goes into how to save back to the database. Can you answer or point out to me a guide that can answer these questions. I have a separate Data project...

WPF layout with several fixed height parts and certain parts relative to window size

Hello, At moment my main layout consists of vertically oriented stack panel and it looks like this: Root StackPanel StackPanel - fixed Height 150 (horizontal orientation) StackPanel - relative Height must be behalf of free space left on screen (but at least 150 px). Used by Telerik GridView Control, if I don't specify Height or Max...

Listview of items from a object selected in another listview

Ok the title maybe a little confusing. I have a database with the table Companies wich has one-to-many relotionship with another table Divisions ( so each company can have many divisions ) and division will have many employees. I have a ListView of the companies. What I wan't is that when I choose a company from the ListView another Lis...

Display Image from Byte Array in WPF - Memory Issues

Hi, I've developed an application to capture and save images to a database, but I'm having an issue with memory usage. On my domain object I have 3 properties: Image - Byte array, contents are a jpg RealImageThumb - The byte array converted to a BitmapImage and shrunk, displayed to the user in a gridview with other thumbnails Real...

Adding a Button to a WPF DataGrid

Hi, I want to create a DataGrid control in WPF in which there is a button in the first cell of each row. Clicking this button will show RowDetailsTemplate or SubRow. My concern is How do i add a button which will show/Hide the RowDetailsTemplate? Any help will be greatly appreciated Thanks ...

How to keep track of TextPointer in WPF RichTextBox?

I'm trying to get my head around the TextPointer class in a WPF RichTextBox. I would like to be able to keep track of them so that I can associate information with areas in the text. I am currently working with a very simple example to try and figure out what is going on. In the PreviewKeyDown event I am storing the caret position and ...

WPF: Binding to ObservableCollection in ControlTemplate is not updated

I created a ControlTemplate for my custom control MyControl. MyControl derives from System.Windows.Controls.Control and defines the following property public ObservableCollection<MyControl> Children{ get; protected set; }. To display the nested child controls I am using an ItemsControl (StackPanel) which is surrounded by a GroupBox. If...

WPF draw Border on MouseOver

Hello, I have a WPF Application where I am trying to make a close button like image. I am trying to draw a border or have a border show up on mouse over... But I cannot seem to make it work. I have tried like 6 different methods of doing so...Images, borders with images, brushes, ect. I am using the following code at the moment: <Canv...

WPF ListView Button - Associate multiple images

I have a listview in a WPF application that has a button in one of its columns. I associate a image to the button control. I want to configure different images for this button based on the How do I write the XAML in this scenario??? This is what I have already: <ControlTemplate x:Key="IconButtonAddProfile" TargetType="{x:Type Button}...

wpf: DataGrid disable selected row styles - or row selecting

I am seeing a lot of examples on how to style Selected rows in DataGrid such as this one: http://stackoverflow.com/questions/1223280/how-can-i-set-the-color-of-a-selected-row-in-datagrid Can i just disabled selected row styling? i don't want to have to override every single thing that selected row changes. Just don't want any visible c...

How can I change the VisualState in a View from the ViewModel?

I'm new to WPF and MVVM. I think this is a simple question. My ViewModel is performing an asynch call to obtain data for a DataGrid which is bound to an ObservableCollection in the ViewModel. When the data is loaded, I set the proper ViewModel property and the DataGrid displays the data with no problem. However, I want to introduce a...

Accessing "current class" from WPF custom MarkupExtension

I'm attempting to write a custom MarkupExtension to make my life easier by giving me a better way to specify bindings in XAML. However I would like to know if there is any way I can access the object that represents the file the MarkupExtension is used in. In other words, suppose I have a UserControl that defines a particular rendition ...

How to bind to method's result in Telerik RadGridView with ObjectDataProvider?

I have Telerik RadGridView. I bind IEnumerable collection where UserRole is my class which describes user's role and contains collection of permission. Imagine that collection of permissions is an array. XAML where I bind data looks like this: <telerik:RadGridView x:Name="grdRoles" Margin="5" IsReadOnly...

WPF MediaElement Natural Duration

Hi, I have a MediaElement which I set its Source to a new Uri based on a valid String. For example: MediaElementName.Source = new Uri("string"); The string is a valid path, and after debugging, sometimes it sets the "MediaElementName"'s NaturalDuration, sometimes it does not.. I have been googling for at least 2 hours now with no wo...

WPF Creating an instance of a class in xaml

Hi, I have a problem with creating the instance of a class in xaml file. I thought you can do it like this: <src:MyDataClass x:Key="data"/> in the resource part of the user control and then use it in the xaml file (for example bind to it). But even tough the class I created is located in the same namespace it says that: "The typ...