wpf

Using binding for the Value property of DataTrigger condition

I'm working on a WPF application and struggling with a data trigger. I'd like to bind the value of the trigger condition to some object I have: <DataTrigger Binding="{Binding Foo}" Value="{Binding ElementName=AnotherElement, Path=Bar}">.. However, I'm not allowed as it doesn't seem to be possible to use bindings for the...

How to reuse this in WPF?

It should look like this: I don't care about reusing it in other applications that need somewhat different looks. It's just for display Content needs to wrap, maximum 3 lines. I'm trying to implement it as a derived class of UserControl with XAML defining the visual elements, but I'm not sure if that's the best option. So how wou...

WPF Dispatcher, Background worker and a whole lot of pain.

Ok this may be really simple but everything I try just seems to hit a brick wall. I have a view model with two properties, which are bound to my WPF form: bool IsWorking {get;set;} ObservableCollection<OtherViewModel> PendingItems {get;set;} I have a method that I call to fetch some new pending items from outlook, however I also wh...

Telerik RadGrid - hide left-most column

Can't remember / driving me crazy - how to hide the upper-left-most cell/column of a Telerik WPF RadGrid (so all column headers are flush-left?) I know it's something ridiculously easy/ simply forgot. ...

Padding text in listbox

Hi everyone, var a1 = "HEL"; var a2 = "HELLO"; var a3 = "LLO"; var length = a2.Length+5; listbox.Items.Add(a1.PadRight(length) +"End"); listbox.Items.Add(a2.PadRight(length) + "End"); listbox.Items.Add(a3.PadRight(length) + "End"); I have code like this to obviously pad all text...

ViewModel communication question

Imagine I have a UserControl that shows a parking lot (my favorite analogy) with cars of different colors. You can select a car, and in a separate UserControl (in a separate project) statistics of the selected car are displayed. Now a user wants a button on the car statistics UC, 'Next car of same color'. When selected it should show ...

WPF TreeView - How to scroll so expanded branch is visible

When I expand items in my treeview so that scrolling is necessary, a scrollbar appears. However, it doesn't scroll down for the newly expanded branch of items - they get cropped by the bottom of the control. So as I continue expanding items at the bottom of the tree, I have to keep manually scrolling down to see the new children. Anyone ...

Adding image in runtime

Hi, Im doing apllication WPF with C#. I have three kinds of images in my folder "Data". I have Iamge abd textblock and one button. when i press button,it will display text in textblock and depends on the text,image may vary.How can i do add image at runtime. public void Adddata(string lData) { Text1.Text =...

Event handler that will be called when an item is added in a listbox

Hi there, Is there an event handler that will be called when an item is added in a listbox in WPF? Thanks! ...

Opening a wpf form in a separate process

We are facing a performance issue with loading and closing and opening a flash file in a wpf form. We can succesfully open a flash file and look at it in a wpf form. Our main window has a tree view. User selects any one node for viewing a flash file. Root/Parent Child1Flash Child2Flash ... .... Users select Child1Flash ...

Attaching events in DataTemplates, which in one ResourceDictionary file.

We have one ResourceDictionary file, contains DataTemplate: <DataTemplate x:Key="HeaderTemplete"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="20" /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="24" /> </Grid.ColumnDefinitions> <CheckB...

Selecteditem color in textBlock in ListBox in WPF

Hi,I have textblcok in my listbox as listboxitem.When i seelct the item in that,it shows blue in color.I dont want that.How can i remve that. My XAML: <ListBoxItem> <StackPanel Margin="10,5,0,0" Name="Stack1" Orientation="Horizontal"> <Image Margin="10,0,0,0" Name="Img1" Height="15"></Image> ...

Using Android app to interact with a Windows application

I'll come up with any excuse to get a chance to write my first Android application. I've never done much with it except for a couple of tutorials. I've got a Windows application that controls a device, and the computer isn't necessarily right next to it. I think it would be great to be able to use my Droid to issue the device commands...

Update WPF controls at run time

I'm trying to write a WPF application that will update a set of text boxes and labels at run time using threads but the problem is that when ever a thread tries to update the text boxes and labels I get the following error: "The calling thread cannot access this object because a different thread owns it." Is it possible to update the co...

OpenFileDialog for selecting more than 1 file with WPF

How can I implement an openfiledialog, which is able to do multiselecting? Do I need an extra libraray or is it also possible with the WPF-Control OpenFileDialog? ...

WPF always focus on a textbox

Hi all! I want to always focus on a specific textbox on my WPF application whenever i click on anything on the applciation it should always focus on the textbox. Is this possible and how please advice and help. Thanks!!! ...

Binding XML Data in a ListBox

Hi there, I have this piece of code: XmlDocument doc = new XmlDocument(); // Initially value "<ParentNode></ParentNode>" doc = mngr.XmlDoc; XmlDataProvider xmlDP = new XmlDataProvider(); xmlDP.Document = doc; xmlDP.XPath = "/ParentNode/ChildNode"; CollectionViewSource collection = new CollectionViewSource(); collection.Source = xmlDP...

updown control in wpf

Hi, I want to use a Similar control like domainUPDown control in my wpf application. How to do the using infragistic or any other way. I need a control like a textbox with up and down button. How to do it? That is ok, but i need tat up and down button for mouse click Thanks, ...

How to clear TextBlock.

Im adding text TextBlock Text1,Text2,Text3 in Adddata() fucntion as follow. if (i == 0) { Text1.Text = tagname.AlarmTag; } if (i == 1) { Text2.Text = tagname.AlarmTag; } if (i == 2) { Text3.Text = tagname.AlarmTag; } Now in deletedata() i want to clear all contents in three textblock. How can i do that?because i cannot fin...

Defining DataTrigger for StackPanel

How do I define a DataTrigger for a StackPanel? It does have a Trigger property, but defining a trigger here gives the following error on Initialize when starting the application: Failed object initialization (ISupportInitialize.EndInit). Triggers collection members must be of type EventTrigger. .... This is given from the follo...