wpf

WPF ComboBox Key Index not working when using data template selector

Hi all, I have a problem regarding WPF combobox when using data template selector. Basically, WPF combobox has a standard behaviour which will take you directly to the item that starts from a character if you type that character using keyboard. I don't know the official name for this functionality and will temporarily call it "Key Inde...

How to implement slider/progressbar for video app, YouTube style?

Hi all, I want to implement slider/progressbar like YouTube style. That means when mouse on the progressbar the tooltip show the time position exactly. How can I do that? Should I use Slider? or perhaps ProgressBar? Thanks in advance! ...

Diagnosing performance problems with databound WPF ComboBox

I've been battling a "slow" WPF ComboBox this morning, and would love to see if anyone has tips for debugging such a problem. Let's say I have two ComboBoxes, A and B. When A changes, the items in B change as well. The ComboBoxes each have their SelectedItem and ItemsSource databound like this: <ComboBox Grid.Column="1" ItemsSource="...

Bind to a property

I have an object(class): Foo. It has a property: Bar. What should I do to be able to Bind to that 'Bar' property? (WPF, .NET 4) EDIT: TO be more explicit, I give an example: I have a Dot:UserControl I create 2 properties of Dot - CenterX and CenterY: public double CenterX { get { return Canv...

ShowDialog makes app window disappear from windows' Alt-Tab list?

hello, i am new to WPF, and i am trying to open a modal dialog from inside my main window: public partial class MainWindow : Window { protected void OpenCommandExecuted(object target, ExecutedRoutedEventArgs e) { DataSearchWindow w = new DataSearchWindow(); w.Owner = this; w.ShowDialog(); } ......

WPF Image : Let user drag the image to the desktop

Hi, I have a WPF user control hosted in a Windows Forms Application and the control contains a WPF image ( among other things ) and was wondering whether it is possible to let the user drag this image to outside the app ( to windows explorer, to the desktop , to a folder) ? Regards, MadSeb ...

WPF - how to hide menu item if command's CanExecute is false?

By default menu items become disabled when its command cannot be executed (CanExecute = false). What is the easiest way to make the menu item visible/collapsed based on the CanExecute method? Thanks for your convenience here's the solution: Bind the visibility property to the IsEnabled property using "Boolean to Visibility" converter....

Radiobutton style based off of custom ToggleButton

I created a custom ToggleButton class, ToggleButtonEx, that extends ToggleButton. ToggleButtonEx contains some dependency properties that I created in order to use them in a template. I want to base the style of all of my radio buttons on the new toggle button style. Here is what I have: The ToggeButtonEx style, which defines the tem...

WPF - ComboBox Not Working Correctly.

Hi, I am developing a WPF appliction in .net 4.0 which has got one user control. For simplicity, this user control has got only one combox which gets its value from view model's observable collection. This observable colletion is populated via a call to EF entity which gets its data from a view. The combobox's itemssource property is bo...

Return custom values from WPF dialog

I am using Window.ShowDialog() method to fetch some values from the user. However, the dialog will only return a nullable bool. How can I get my WPF window to return a Tuple<string,string> or any other type? ...

Remove images from RichTextBox FlowDocument

I have a WPF application on wich the user can paste some data from Word inside a RichTextBox... but if that word data has an image, I need to remove it, how can I acomplish that? Since the FlowDocument is xml, maybe doing some linq magic could do it, but I don't know how :/ ...

How can you reference a fully defined control as a resource within WPF?

I am aware I can reference styles & templates from a resource dictionary and I make significant use of them. But what about complete controls? I can declare a fully defined WPF control, like a button, within the app.xaml as a resource. For example, the app.xaml file defining a button would contain this: <Button x:Key="HelpButton" Cont...

MVVM Silverlight Framework Choices

Which Silverlight MVVM Frameworks should I look at - taking into account these areas of functionality. 1) IoC - can I choose my own? I would like to avoid using MEF w/ Attributes. 2) Navigation 3) Callback simplification 4) "IMessageBox" type abstractions 5) Testability 6) Logging Note: mitigating a conversion to full-blown WPF is n...

WPF Web (xbap) using WCF Service throws System.Net.webPermission exception

I have an xbap application running with partial trust on my local machine's IIS 7.5. I published the WCF service to the same directery as the xbap. After jumping through some hoops I could get it working through Visual Studio for debugging perposes, but I can't seem to get it to work on an IIS server after it's published. I'm running o...

WPF BackgroundWorker vs. Dispatcher

In my WPF application I need to do an async-operation then I need to update the GUI. And this thing I have to do many times in different moment with different oparations. I know two ways to do this: Dispatcher and BackgroundWorker. Because when I will chose it will be hard for me to go back, I ask you: what is better? What are the reaso...

Change selection "style" in WPF

I have a chart with some lines in a WPF application. When the line is (mouse) selected by the user I need to change its look. à la : In WPF the two lines code could be as follows: <Line X1= "10" Y1="20" X2="150" Y2="20" Stroke="Black" StrokeThickness="1" /> <Line X1= "10" Y1="50...

How to convert a System.Drawing.Drawing2D.LinearGradientBrush to a System.Windows.Media.LinearGradientBrush ?

I trying to port System.Drawing: public LinearGradientBrush( Rectangle rect, Color color1, Color color2, float angle ) to System.Windows.Media . I can get the angle to be correct but I can't get the start and end to be at the corners. I have tried scaling the brush's transform but that ends up messing the angle. Syste...

WPF StringFormat databinding text not appearing

I am trying to get the header text of a TreeviewItem to be set in the binding to an XML source. Everything is working fine except the only thing that appears in the header is the text I'm binding to and nothing else in the string format. Example: <HierarchicalDataTemplate x:Key="LogDataTemp" ItemsSource="{Binding Path=log}"> <Tree...

Recreating <BevelBitmapEffect> in a Pixel Shader/Other Method in WPF

Now that <BevelBitmapEffect> (amongst other effects) has been depreciated, I'm looking to see how I could re-create the exact same thing in a Shader Effect (including it's properties of BevelWidth, EdgeProfile, LightAngle, Relief and Smoothness). I'm somewhat familar with pixel shading, mostly just colors manipulation of the whole image...

<ContentControl><ContentPresenter/></ContentControl> ?

hello, I am looking at someone's control template and wherever this template needs to include content, it uses: <ContentControl> <ContentPresenter /> </ContentControl> Why not use just <ContentPresenter />? Is there any reason why it needs to be wrapped in ContentControl? Thanks konstantin ...