wpf

ItemsControl ItemTemplate Binding

Hi All, In WPF4.0, I have a class that contains other class types as properties (combining multiple data types for display). Something like: public partial class Owner { public string OwnerName { get; set; } public int OwnerId { get; set; } } partial class ForDisplay { public Owner OwnerData { get; set; } publi...

ContentPresenter within ControlTemplate cannot change attached dependency property

Why does the following simplified code not sets the font-size of the TextBlock to 50? <Window.Resources> <ControlTemplate TargetType="ContentControl" x:Key="Test"> <ContentPresenter TextBlock.FontSize="50" /> </ControlTemplate> </Window.Resources> <Grid> <ContentControl Template="{StaticResource Test}...

Automatically freeze wpf-objects built from templates

Is it right that wpf-objects that are freezable are freezed in any case automatically if they are generated through a DataTemplate, ControlTemplate or a style? ...

WPF Grid SharedSizeGroup error

If you run this code and click on tab 2 and then back on tab 1 the application goes insane and starts bouncing the column widths back and forth. Any suggestions on how to fix this? <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" ...

Get Grid visible screen rectangle

Hello, How can I with WPF Get the visible rectangle of a zoomed Grid? I Want to place a control in the middle of the visible area and i'm not having success. Any clue? Thanks in advance. ...

WPF Viewbox size changes but PointToScreen of child is always same

Hi, In order to handle multiple resolutions I have following controls in the same xaml page. Grid -> Viewbox (stretch, centered) -> Canvas (centered) -> Rectangle X (centered) FrameworkElement I am trying to cover the whole page with a black overlay and cut a rectangle for the Rectangle X in the center of the page. To create the b...

WPF Usercontrol interaction with parent view / viewmodel

Hi I have a mainView window which has its dataContext set to it's own viewModel. On that viewModel is a DateTime property which in turn is bound to a datepicker on my main view using 2 way binding. <toolkit:DatePicker DateSelected="{Binding mainDateTimeProperty, Mode=TwoWay}" /> This is all fine so far. On the change of my datetime p...

Proper way in MVVM to drive visual states.

Given a content presenter that can display one of 4 different application pages, and I want to fade/otherwise animate a transition between pages based on view model state. Ideally I'd like to have these all defined within a DataTemplate, and then trigger transitions based on an enum from the view model, so that when some enum representi...

Display small form while main form is "locked"

Hi there, i'm thinking about writing a WPF program that would require login and password at the app startup. I thought about small form with two textboxes as a login form. User will have to fill in his details and then the main form of the application will be unlocked. How will you solve this? Thanks for your answers, daemonsvk ...

Dependency Property Binding Not Updating Target

I have a custom dependency property: public static readonly DependencyProperty HeaderProperty = DependencyProperty.Register("HeaderProperty", typeof(string), typeof(RadAdjustableSlider)); public string Header { get { return (string)GetValue(HeaderProperty); } set { ...

WPF Control validation

Hi all, I'm developing a WPF GUI framework and have had bad experiences with two way binding and lots of un-needed events being fire(mainly in Flex) so I have gone down the route of having bindings (string that represent object paths) in my controls. When a view is requested to be displayed the controller loads the view, and gets the n...

adding tabs to tabcontrol from inside usercontrol

How can I add tabs to a tabcontrol that exists in one usercontrol from another usercontrol that is contained within a tab itself?? Can I do it without passing in the tabcontrol as a parameter in the constructor, perhaps via some static global method? I've tried public static ObservableTabCollection FindCollectionFromUC(this Dependency...

wpf style converter : "Convert" called by every datagrid column using it

I created a converter, and assigned it to a style. than i assigned that style, to the columns i want affected. as rows are added, and while stepping through debugger, i noticed that the converter convert method gets called 1 time per column (each time it is used). is there a way to optimize it better, so that it gets called only onc...

WPF MVVM Pattern - References

Hi everyone I wanted to know if some of you guys can post some articles, blog posts etc. that explain the MVVM Pattern in detail. There are not much explainations out there I think ( except Tutorials). I'm going to write my exam about WPF and also want to build in the MVVM Pattern. So I need some good references that are also digging a ...

How can I default WPF Items to private instead of internal?

I would like all WPF XAML items to default to private instead of internal. Is this possible within Visual Studio 2010? ...

databinding to self without code

I'm building a UserControl in WPF. The control has two properties, Title and Description, that I'd like to bind to two textblocks. Seems real straightforward, and I got it working, but I'm curious about something. To get it to work I had to add this code: void CommandBlock_Loaded(object sender, RoutedEventArgs e) { this...

how to launch other program in WPF like windows form process.start

i used process.start in windows form to launch other program but now i want to use wpf to launch it and i dont know how and what is equivalent to it ? <Button Margin="0,362,-432,-88" Name="activation" Click="button1_Click" Foreground="Blue" HorizontalAlignment="Right" Width="134" Grid.Column="1"> activate virtual mouse </But...

How can I raise a parent event from a user control in WPF?

I have a user control that is loaded into the parent window, and I want to raise a parent event when a button on the user control is clicked. How can I communicate with the parent through my user control in WPF? ...

WPF key gesture PageDown shows up as Next in Menu Item.

I've setup a custom command with PageDown as the key gesture, but for the MenuItem that is bound to that command the gesture shows up as "Next". The problem is that I have commands that use PageUp, Home, and End for related tasks and they all show up as expected for their MenuItems. Is there some way to make the MenuItem show "PageDown...

WPF application which calls an API, which needs a message pump

I have a WPF application that calls an API to operate a device (a scanner). This API is COM based, and internally has a hidden window that the scanner sends messsages too. The intent of the API is to turn those windows messages into COM events. The problem is that the WPF application doesn't have a message pump, and therefore none of the...