wpf

WPF Simple Binding to an objects property

Hi, Im having some problems with binding in wpf/xaml. Have this simple file: <Window x:Class="test.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300"> <Grid> <TextBlock Height="21" Foreground="B...

Selected item loses style when focus moved out in WPF ListBox

What do I have? I have a ListBox populated with items from an XML file. Given a DynamicResource for Style property and written trigger for IsSelected in ItemContainerStyle. What do I want to do? I want to keep the selected Item highlighted even after focus moved out of the ListBox. What problem am I facing? When I select an item...

WPF Styles, BasedOn, & Storyboards

I am trying to create a simple style that highlights the focused UI Element (Textbox,combo,etc) while it has focus, and goes away when lost focus. I came up with this: ` <Style TargetType="{x:Type FrameworkElement}" x:Key="OnFocus"> <Setter Property="Effect"> <Setter.Value> <DropShadowEffect Col...

Is is possible to record my WPF control to a movie?

Hi, I have an application where it is possible to load new content through usercontrols. Some of these usercontrols have distinct features such as pulsing buttons and other kind of animations. What i want to do is provide the user with a small video that shows the usercontrol in action. The user adds usercontrols through an ASP.NEt MVC ...

My First WPF/MVVM App

Ok so.. I'm a bit lost. What i have is a window1.xaml just a combobox that selects different Enviroments then i have a which displays data based on environment I have a default environment when app loads up and displays the correct data. Question: I want the Dashboards data to change when a different Environment is selected. I'...

Add Composite WPF Region at runtime

Ok, here's my simple scenario. I've got collection of strings that I'm binding to a TabControl as a proof of concept. As I add strings I want a new tab with the region name as the header and a ItemsControl in the Tab container. That ItemsControl should define a new region. <TabControl x:Name="tabDemo" ItemsSource="{Binding D...

ListBox List Rotation

Hi, I want to create a ListBox that basically displays a circular list. For example a list with three items 1 2 3 <- (Selector on item 3) will rotate the list and have the selector over item 1 after passing item 3 2 3 1 <- (Selector on item 1) This is similar to the menu paradigm of the Windows Media Center. What part of the ListB...

Use webservice referenced in WPF UserControl

Hi I have a wpf app with a usercontrol, within the user control I want to call a referenced webservice. What is the code syntax to do that? I can't seem to figure it out. Thanks, CC ...

how to change the visual state of a WPF control based on evaluation of other Visual Elements?

I want to do the following: <TextBlock Text="{Binding Result}"> I want to Color this based on an equality check on Result, what's the view centric way to do this? I remember reading about template selector, is that the right choice here? example: Text="Pass" Color="Green" Text="Fail" Color="Red" I'd like this to be dynamic so t...

WPF Paper-like control

I want to create a WPF control that look like a white sheet of paper floating inside a container of some sort. I want to be able to drag the paper around and zoom. I am rather new to WPF and I would like to know which control I should look into to create that. I presume the paper itself will be a inkcanvas, but what control should the ...

Visual C# WPF, customizing the uniform grid component

I'm trying to use the Uniform grid control to organize several buttons (to be specific it is a calculator, and I'm trying to create the buttons from my numberpad) I think the uniform grid is what I want to use to organize my buttons, but I can't seem to figure out how to make a button "span" multiple rows. For example the + button on mo...

How to access WPF controls from standard CS file

Hello there, Again, need your hands. I have one WPF application that will invoke some methods hosted in second AppDomain, now, I want to access one WPF control (ProgressBar) from one separate class file(not code-behind), which extends from MarshalByRefObject, I need to do this like below: using System; using System.Collections.Generic...

How to set textblock or label with resizable font size in WPF?

Hi, In WPF, if i put any controls in grid, if i resize the grid, it automatically resizes all the controls in it.But in label or textblock or any other text elements, all the control sizes will change but font size remains same, it will not change. If font has to change as per grid size, What should be done? Thnaks, ...

ViewModel and user interface project locations

Im writing a wpf project and using the MVVM paradigm, what i was wondering is if i should write my view model classes in their own project. Advantages i can see is that your ui project would never have to know about your business logic. (not have a reference to it) however if i want to use the ICommand interface in my view model i stil...

How can I retrieve hyperlink url from selection text in WPF Richtextbox

How can I retrieve hyperlink url from selection text in WPF Richtextbox? I select a hyperlink string in wpf richtextbox. How can I retrieve the url hyperlink of the selected text? I use the snipset code below. But It cannot effect. TextPointer caretPosition = mainRTB.Selection.Start; Hyperlink hlEdit = GetHyperlinkAncestor(caretPosit...

Changing the colour of Aero glass for my window?

I'm using DwmExtendFrameIntoClientArea in my WPF application to get the glass effect. This is working fine. What I'd like to do is change the colour used for the glass -- I'm writing a countdown timer, and I'd like the window to be the normal glass colour most of the time, and then to go red (but still with glass) when the time runs out....

WPF Window with Style=None cover taskbar when Maximised after app initialization.

I want to achieve the same effect as Windows Media Player or Browser based Flash players which take up the ENTIRE (not even the taskbar is visible) real estate when maximised. This works fine if the WindowState is set to Maximised and the WindowStyle is set to None in XAML so the app is started in that state. Problem is I want to start ...

How do I handle opening and closing new Windows with MVVM?

With MVVM and WPF what would be a good/straightforward way to handle opening and closing new windows and dialogs? Opening and closing should be driven by the ViewModel right? But the ViewModel should not know about the view ... ...

Using databinding whenever I can?

Hello! I have a Question: Should I use databinding whenever I can? I will explain myself. I have a class instantiated on the Main Windows ViewModel, I have this class istantiated because I have a section on the window that will use it. The problem is that section on the window will be used very few times, then, I have a class instan...

How to remove the dropdown icon on a WPF ToolBarTray?

How can I get rid of the grey dropdown area to the right of the text in the toolbar item below? Here is the code which produces it: ToolBar tb = new ToolBar(); tb.Background = new SolidColorBrush(Colors.Transparent); Button button = new Button(); button.Content = "test"; button.Click += new RoutedEventHandler(button_Click); tb.Items....