wpf

Strange XAML MenuItem DataBound ItemsSource Refresh Issue after empty ItemsSource

I have a XAML MenuItem DataBound ItemsSource that is working fine however there is a small issue. When I view the MenuItem and there is no databound items the ParentMenu will be disabled and it appears fine without binding errors (as expected the ItemsSource is empty). If the ObservableCollection is modified and an item added, the bind...

How to make custom class bindable in WPF?

I have a class, internal class PageInformation : DependencyObject { public static DependencyProperty NameProperty = DependencyProperty.Register("Name", typeof(string), typeof(PageInformation)); public static DependencyProperty PageUriProperty = DependencyProperty.Register("PageUri", typeof(string), typeof(PageInfo...

How to test WPF components in VS08 unit testing framework?

I have created some tests in my WPF application. Right now I am working on testing single components, for example images and text blocks. If I run a single test in my unit tests, they all pass without a hitch. The problem occurs when I try run all the tests, I get the following errors in the tests that create and modify WPF components: ...

Search component for WPF textbox

I'm looking for a WPF textarea component that would allow the user to search inside it. Something similar to the notepad, but as a reusable component. ...

Creating a xaml button with rectangle

I'm trying to create a "button" with a rectangle since we're gonna have different images on MouseOver, Clicked and the "normal" state. We started to use the button control but after setting the image on it in Vista using Chrome as the theme then when hovering the button the image got blurred out. The images are created by the graphics t...

Apply style to all TreeViewItem

Hi The problem am having is that I have multiple TreeView control and each TreeView has its own TreeViewItem styles, setting it TreeView ItemContainerStyle="{StaticResource Style1}" will only set the root element NOT all the child elements, How to apply a style to all the child elements in a TreeView ...

Transparency in WPF

When I want a window to be transparent I have to set AllowsTransparency to True. When I set this the outer boarder(You know the close and minimize button and all) disappear also. Oh, I am using Blend 3 to do this(Just got it, it's very nice). ...

Applying style to row above

I've created quite a satisfying 'magnifying glass' effect on a list view <Trigger Property="IsMouseOver" Value="True"> <Setter Property="FontSize" Value="14"/> </Trigger> However, what I'd really like to do is have the rows above and below set to, say, 12. I suspect this is asking a bit to much, but just in case anyone has an ide...

What is the difference between triggers and events in WPF?

What are main difference between Triggers and Events in WPF ? We can do all the stuffs using events, which we can do through triggers, so why we need triggers? ...

How to use quote " character in XAML binding?

I'm trying to do this: <TextBlock Text="{Binding Path=Text, Converter={StaticResource stringFormatConverter}, ConverterParameter='\"{0}\"'}" /> But this is apparently not the way to get a quote into a XAML binding string. What is the appropriate way to get "\"{0}"\" to work here? ...

How to put a unicode character in XAML?

I'm trying to do this: <TextBlock Text="{Binding Path=Text, Converter={StaticResource stringFormatConverter}, ConverterParameter='&\u2014{0}'}" /> To get a to appear in front of the text. It doesn't work. What should I be doing here? ...

Set RTF text into WPF RichTextBox control

Hi, I have this RTF text: {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Arial;}} {\colortbl ;\red0\green0\blue0;\red255\green0\blue0;} \viewkind4\uc1\pard\qc\cf1\fs16 test \b bold \cf2\b0\i italic\cf0\i0\fs17 \par } How to set this text into WPF RichTextBox? Solution: public void SetRTFText(string ...

How Do You Create a Local Reference a TabItem ?

Trying to parse Maplines for an airport. Each airport can have X number of different configurations. In code behind I parse each configuration into a separate collection of custom objects which is data bound to the TabItem below. Currently this TabItem is "Hard Coded" in the XAML body. How do I create a template that I can declare fr...

WPF Listview SelectionChanged event

Hi I have a listview binding to an ItemsSource. Why is the SelectionChanged event firing on the load/databoound events? I assume that it is because a 'default' items ie index 0 is selected. How can I disable this, because when selecting an item updated other sources with data. Thanks Petrus ...

How do i save changes back to database from wpf toolkit datagrid???

i write this code in my project: DatabaseDataContext dataContext = new DatabaseDataContext(); IQueryable<Available_Time_Teacher> att = from r in dataContext.Available_Time_Teachers where r.Teacher_ID == id select r; ...

C#/WPF: Disable Text-Wrap of RichTextBox

Hi, Does anyone know how I can disable the text wrapping of a RichTextBox? E.g. if I have a large string which doesn't fit in the window, the RichTextBox places the part of the string which can't be shown of a new line. I want to disable that (and make it visible only by using the Scrollbar). Thanks a lot. Cheers ...

RibbonDropDownButton dynamically load item

Hey,I'm currently using the WPF Ribbon ctp RibbonDropDownButton and i'm binding to a collection to get from it all the items. The problem with that is that i can't add a command for each item in that way... (when an item is selected) I thought of an alternative to add the items when i click on the ribbon drop down button, but there isn'...

WPF Toolkit - Fit datagrid height to content height

Hello, I have a WPF datagrid and would like it's height to equal the sum of the heights of it's rows + header. i.e. if my datagrid header is 100px and I have 4 rows, each 50px in height the total height of my datagrid should be 300px. Is there a way of declaratively specifying that the height should match the sum of it's contents? T...

WPF Adorner Transforms

Hi, I am building a control, where the user can "draw" resizable rectangles that are laid over the content. To resize those rectangles, I use an Adorner on top of them which contains 4 Thumbs to change the size of the rectangle. The problem is, that this control is is "zoomable", meaning a ScaleTransform is applied to the whole control...

wpf change image source

I know this is an easy question but I can't figure it out or find the answer anywhere. I'm just trying to change the image source during runtime in WPF using C#. Whenever the code runs, it just removes 1.gif and has a blank white box, instead of displaying 2.gif. Thanks in advance. XAML: <Image x:Name="img" Height="150" Margin="142,...