I would like to create a TextBox that only accepts numeric values, in a specific range.
What is the best way to implement such TextBox?
I thought about deriving TextBox and to override the validation and coercion of the TextProperty. However, I am not sure how to do this, and I understand that deriving WPF control is generally not recom...
I've read in a blog the following sentence:
The first rule of WPF:
Avoid control inheritance.
I've seen similar things in other places as well.
However, I fail to understand the logic.
Moreover, I see suggestions here in StackOverflow that involves inheriting WPF controls (see the replies to my previous question for example).
I...
I am using WPF and Silverlight BookControls by Mitsu
http://www.codeplex.com/wpfbookcontrol
The WPF example alows that every page in the book to be a XAML file, but the Silverlight example dont.
Is there a way load a XAML in every book page in the Silverlight example ?
...
I am using the MVVM pattern to develop a WPF application.
The app loads a captcha image from the server, and assigns it
to an Image on the WPF form when ready. I am using a
BackgroundWorker to do the threading for me, as follows:
When the Window is being loaded, the following is called:
BackgroundWorker _bgWorker = new BackgroundWork...
I have a WPF MVVM application. In the View I have a multiselect ListBox. In the ViewModel I have a property for the selected items in the List.
Using a technique similar to the one in the answer to this question I can bind my property to the ListBox.
But I also want to do data validation via IDataErrorInfo. All I want to do is check th...
I've got a TabControl whose ItemsSource is bound to an observable collection of views (UserControls) each which have as its root element a TabItem. However, when it is displayed, the Header text is in content of each TabItem, as if UserControl wrapper is causing conflicts:
The TabControl is in SmartFormView.xaml:
<UserControl x:Class...
I made a custom control called SmartTabItem, currently just the default implementation:
using System.Windows;
using System.Windows.Controls;
namespace TestControl.Controls
{
public class SmartTabItem : TabItem
{
static SmartTabItem()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(SmartTabItem), ne...
How can I tell my TabControl to set the focus to its first TabItem, something like this:
PSEUDO-CODE:
((TabItem)(MainTabControl.Children[0])).SetFocus();
...
This is the code-behind of my view:
using System.Windows.Controls;
namespace TestBoundTabControl.Views
{
public partial class SmartFormView : UserControl
{
public SmartFormView()
{
InitializeComponent();
}
public void BeforeLoad()
{
MainTabControl.SelectedIndex = ...
Hi,
There's a strange behaviour when using WPF in windows vista:
i want my menu items to be White on the MainMenu of my application, while the children remain regular color.
So i set the Foreground property to white (on the top level)
in vista the child menu items inherit this foreground (!)
Does any have a solution for that?
Note: ...
What is the simplest way to put a little delimiter/line between 2 menu items in WPF?
...
Hello,
Does anyone know why my ListView with following Code is not working?
I checked it out with Snoop and the ItemsSource seems to be fine (and when I start Snoop, the ListView displays me the MyViewModel.MyCollection, but when debugging with Visual Studio it shows me nothing?)
Thank you!
PS: MainWindow.xaml.cs has the DataContext = ...
In WPF, I can group, but the default is group with ascending. One of my need to to be able to control the sorting of the group (Ascending or descending). For example:
group 1
item 1.1
item 1.2
item 1.3
group 2
item 2.1
item 2.2
and also be able to switch to:
group 2
item 2.1
item 2.2
group 1
item 1.1
item 1.2
item...
I'm using an ObjectDataProvider to call a class of with IObservableCollection:
<ObjectDataProvider x:Key="WaitingPatientDS"
ObjectType="{x:Type local:clsPatients}">
<ObjectDataProvider.ConstructorParameters>
<sys:Boolean>True</sys:Boolean>
</ObjectDataProvider.ConstructorParameters>
</ObjectDataProvider>
c...
I want to have an ItemsControl in which the items are displayed horizontally.
However, no matter if I use StackPanel with Orientation="Horizontal" or WrapPanel, they still stack up.
How can I get items in an ItemsControl to be horizontally?
XAML:
<Window x:Class="TestItemsControl2938.Window1"
xmlns="http://schemas.microsoft.com...
I'm trying to get one style going that performs all of my triggers. This is what I have, but the SoundPlayerAction is not firing:
<Style x:Key="{x:Type ListBoxItem}" TargetType="ListBoxItem">
<Setter Property="SnapsToDevicePixels" Value="true"/>
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Pro...
When I compile my C# WPF project in release configuration mode with Visual Studio 2008 and run the project on my computer I have no problem at all. If I move the Release directory onto another computer (that does not have Visual Studio) everything seems to work except OLE DB. This is probably because the other computer does not have what...
I need all children of a view to know a piece of contextual information (the person they need to show). I also need the approach to be compatible with MVVM. I tried to do this with RegionContext in my Prism application. Here's my approach and problems:
I have a TabControl that I use View Injection to populate with views so that I can...
I'm working on an app where I have a bunch of text in a RichTextBox. I'm jumping to various positions within the text, (hopping to an arbitrary paragraph for example) which seems to work by send the caret to that position but I can't seem to control where in the viewable area the caret ends up.
Sometimes the caret ends up at the top of...
WPF Automatically remembers control state for Dependency Properties with the Journal metadata flag.
On top of this you can implement IProvideCustomContentState to provide your own custom state information.
However, I can't find a way to do ONLY custom state and turn off the automatic Dependency Property state tracking. I want to do th...