I've some code in my view model as follows:
miService.GetSomething(par1, par2)
.ObserveOnDispatcher()
.Subscribe(dt =>
{
DoSomething(dt);
});
Then in my test, I'm "mocking" my service as follows:
miService.Setup(ms => ms.GetSomething(....))
.Returns(Observable.Return(XYZ));
The problem is that due to the ObserveOnDispatcher, ...
I have a class for my data, MyData, and I'm accessing it in my gui by data binding. I decided to set the DataContext of the main panel in my window to an instance of this object so I could bind my various controls to it's members. So I could easily reference it in my xaml, I created an instance of MyData in Window.Resources like so:
<lo...
Hello,
I need to render some rich text to a pdf. The difficulty is, i need the text on the pdf to look exactly like the text in the WPF RichTextBox. The pdf renderer i'm using renders according to html, so converting from richtext to html sometimes causes lines to wrap/break at different points. Is there any way to get the text from t...
I have two libraries and a single application assembly project layout and I'm wondering how can I reference styles by their key in one of my libraries that's defined in the other.
My solution layout:
WpfControls.dll - Holds generic reusable controls such as a WPF based NumericUpDown control as well as other basic controls and some st...
Hi !
I've got Custom Control with a TextBox in the default Template.
The Custom Control has these 2 dependency properties (among others):
SelectedValue, NullText (text to appear in the TextBox when nothing is selected and the value is provided)
I'd like to set the TextBox.Text with the NullText value when the SelectedValue null is and...
Hi
How do I programmatically find a control inside an itemtemplates datatemplate, e.g. how do I find the checkbox inside the following code:
<ListBox.ItemTemplate>
<DataTemplate>
<CheckBox x:Name="KontoFeltCheckBox"
Checked="KontoFeltCheckBox_Checked"
...
I have a user control that has 5 rectangle shapes in it. I would like to be able to change the size of this control when I use it, but the rectangles don't scale with the control when I put it in the designer and resize it there, they just get covered up or don't expand. This seems like it should be very simple but it's eluding me.
<Us...
I have a bunch of buttons in my application which look almost the same. The only difference between them is the path data that they use.
This is the style i have for the "minimize button" of my application:
<Style x:Key="MinimizeButton" TargetType="{x:Type Button}">
<Setter Property="Template">
<Setter.Value>
<C...
Hi there,
I have a Storyboard which animates the Y-Coordinate of a Grid via TranslateTransform. Within the Completed-Event of the Storyboard I want to reset the Coordinate. How do I implement this?
...
I have been given the task of converting a forms application to WPF. The application used TreeNode which is from System.Windows.Forms.TreeView. I know WPF has TreeView but i cant find TreeNode is there a direct conversion for it from Forms to WPF?
...
Hi,
How to call a call method from xaml in wpf?
Thanks in advance
...
If i place a button within a toolbar in WPF:
<ToolBar FocusManager.IsFocusScope="False" Grid.Row="1" Name="tools" DataContext="{Binding Path=WeekNavigator}">
<Button Content="_>" Command="{Binding Path=CommandNavigateToNextWeek}"/>
</ToolBar>
The text of the button displays "_>" instead of just ">" and the mnemonic do...
I am trying to use a WPF window from a legacy c++ unmanaged gtk gui application. Is it possible to package the WPF window (including the xaml file) and use it in the c++ gui application as a regular com object. Do you foresee any issues or problems with this approach?
If possible any links or tutorials or any suggestions on how to do it...
While creating a customized editor with RichTextBox, I've face the problem of finding deleted/inserted text with the provided information with TextChanged event.
The instance of TextChangedEventArgs has some useful data, but I guess it does not cover all the needs. Suppose a scenario which multiple paragraphs are inserted, and at the sa...
Hi, I'm trying to create a button that behaves similarly to the "slide" button on the iPhone. I have an animation that adjusts the position and width of the button, but I want these values to be based on the text used in the control. Currently, they're hardcoded.
Here's my working XAML, so far:
<CheckBox x:Class="Smt.Controls.Slide...
I have a WPF application which was written in C#. This application hasn't been written with any particular design pattern in mind, but as I have learnt .NET I've realised that the MVVM model would be suitable. Thus, I'd like to start converting the code.
This will be the first time I've used MVVM, and whilst I'm willing to get stuck in,...
I've got a problem with my little app here that is conceptually very simple. I have an XML file that essentially just maps strings to strings.
Long-winded explanation warning
A sample file would look something like this:
<Candies>
<Sees>Box1</Sees>
<Hersheys>Box2</Hersheys>
<Godiva>Box3</Godiva>
</Candies>
Although I coul...
I'm trying to figure out how to cancel user input in a TextBox when a validation error occurs. If the user attempts to enter an invalid character I would like to prevent it from being added to the TextBox.
How can I add to or modify the code below to prevent the TextBox from accepting invalid characters? Is it possible without listening...
When playing an MPEG2 video using a WPF MediaElement, the parts of the video that should be black are gray. There is no alpha in the video, and the video has accurate color when played via Windows Media Player or Quicktime Player.
Does anyone know what I might be doing wrong, or what codec is recommended to get accurate blacks? I'm more...
I currently have the following red border, signifying invalid entry, around textboxes in an application.
It just doesn't look right to me, it has square borders around rounded corners and the drop shadow is the wrong colour.
What is the best way of achieving a decent looking border around the text boxes?
...