Okay here is a softball beginner WPF question.
By default the background of the window is white. I'm trying to hack in an error reporting form and I want to emulate the more standard windows look and feel.
Any easy way to grab the default color for the background?
...
Please, help me to identify problem in my C# code(WPF, event-handler):
private void Discount5Btn_Click(object sender, RoutedEventArgs e)
{
decimal catPr;
decimal salePr;
string catPrStr;
catPrStr = PriceCatTBox.Text;
catPr = decimal.Parse(catPrStr);
salePr = decimal.Multiply(ca...
How do I use the datagrid.SelectedItem to select a row programmatically?
Do I first have to create a IEnumerable of DatagridRow objects and pass the matching row to this SelectedItem property or how do I do it?
EDIT:
I need to match the cell content of the first columns cell with a textbox.text first, before selecting the row.
...
Inserting a Slider in a Grid would expand it to fill the available space, but I would prefer not use a grid for the following reason:
I've a TextBlock and a Slider in a UserControl, the slider is spring loaded and does jog / shuttle; the current value has to be displayed because the user can't rely on the neutral cursor's position, so t...
I have been wrestling with getting databinding to work in WPF for a little over a week. I did get valuable help here regarding the DataContext, and I did get databinding to work via DependencyProperties. While I was learning about databinding, I came across numerous discussions about INotifyPropertyChanged and how it is better than DPs...
I have a DataTrigger that I recently refactored. It used to have the "DataContext" set to be a ListBoxItem. Now it is a ContentPresenter.
Here is the code:
<DataTemplate.Triggers>
<DataTrigger Value="True">
<DataTrigger.Binding>
<MultiBinding Converter="{StaticResource DisableWorkItemConverter}">
...
Simple question. How can I change the icons of the close, minimize, maximize buttons. Can I do this in Winforms and WPF?
...
How could I reach the string value of DatePicker which located in another WPF window?
Something like that (on button click):
private void button1_Click(object sender, RoutedEventArgs e)
{
datePicker1.Text = datePickerFromAnotherWindow.Text;//error: the name does not exist in the current context
}
DatePicker is from d...
Hi.
I am binding WPF with Entity-Framework.
The Window.DataContext property is set to a Quote.
This Quote has a property Job, that I have to trigger Quote.JobReference.Load it should load from the server.
<ContentControl Content="{Binding Job}"
ContentTemplate="{StaticResource JobTemplateSummary}"/>
As you can see above, I am t...
I have a TextBlock (acutally a whole bunch of TextBlocks) where I set the Text to "" if a DependencyProperty in my ViewModel is set to Visiblity.Hidden. I do this via a converter as follows:
<TextBlock Margin="0,0,5,0">
<TextBlock.Text>
<Binding Converter="{StaticResource GetVisibilityOfColumnTitles}"
Path="Name" />
...
I am writing an wpf application with multiple skins. The code to switch theme is as below:
try
{
Application.Current.Resources.MergedDictionaries.Add( resource );
}
catch( Exception ex )
{
}
The first time the code is called (to switch to a new theme), it is executed successfully; however, any subsequent calls to the same code wo...
I have a WPF application that works on XP and usually(?) works on Windows 7. The twain library is raising a Win32Exception when I try to enable the twain GUI. On-screen, I see the GUI come up and start to give images (this is a USB 2820 video, for what that's worth), but it quickly crashes.
The exception's message is that it "Cannot c...
My prototype displays "documents" that contain "pages" that are
represented by thumbnail images. Each document can have
any number of pages. For example, there might be
1000 documents with 5 pages each, or 5 documents with 1000 pages
each, or somewhere inbetween. Documents do not contain other documents.
In my xaml markup I have a List...
I have a custom class, "FavoriteColor" that has three properties, R, G and B. Now I want to draw a rectangle and fill it with these R, G and B values (using databinding). I tried the following snippet in my xaml, but gives me a compile time error.
<Rectangle Width="10" Height="10" Grid.Column="4">
...
I'm in a mess with visibility between classes. Please, help me with this newbie question.
I have two controls (DatePickers from default WPF toolbox) which are in different windows, so in different classes. I can easily access these controls properties like datePicker1.Text from within its native class, i.e. in its native window, but whe...
I have a ViewModel in WPF that looks something like this:
public class SwatchViewModel
{
public ObservableCollection<Color> Colors { get; private set; }
}
I want to display each of the colors in the collection, laying them out in columns. Each of the columns should take up the same amount of space in the control and all columns co...
In WPF app inside a TabControl there is TabItem element with one Label. I want fire event on MouseClick on the Tab of this TabControl, but the event "MouseLeftButtonDown":
<TabItem Header="Header1" MouseLeftButtonDown="TabItem_MouseLeftButtonDown" >
<Label Height="28" Name="AdderLbl" Width="120" Background="Azure" >Label</Label>
<...
I have a TextBlock within a ScrollViewer that aligns with stretch to its window. I need the TextBlock to behave as the following:
Resizes with window, no scrollbars
When resized below a certain width the TextBlock needs to keep a MinWidth and scrollbars should appear
TextWrapping or TextTrimming should work appropriately
How can I ...
MVVM question.
Messaging between ViewModel and View, how is it best implemented?
The application has some points of “user communication” such as: “You have entered comments for this selection. Do you wish to save or discard” when the value of a Yes/No/NA selection changes.
So I need some proscribed way of the View binding to the ViewM...
I am getting the following exception when I deploy my WPF app to another user's machine:
An unhandled exception of type
'System.Windows.Markup.XamlParseException'
occurred in PresentationFramework.dll
However, the WPF app runs fine when I open it. The app crashes at StartUp with this message. I've double-checked to make sure ...