I got a WPF MVVM application containing a ListView containing a GridView.
Using a helper class I'm creating the GridViewColumn's, which works nicely.
My problem: I want to twoway-bind the width so I can read back changes to the width.
The code to create the GridViewColumn right now looks like this:
private static GridViewColumn Create...
Hi all,
Im all new in the world of C# and .net platform,so please be easy on me.
This forum helped me in a few problems that i came into while doing my project,but im now stuck on this for a few days.
What i'm trying to achieve is to set the selecteditem of a combobox by passing a string to it.
The scenario is :
I have a datatable and im...
I have a stackpanel with checkboxes.
I cant seem to make same spacing between checkboxes with margin property
Can some1 tell me what am i doing wrong?
The code below gives me this:
As you can see, the spacing between elements is not constant !
<StackPanel MinWidth="150" cal:Bind.Model="{Binding}" Orientation="Horizontal">
<Stac...
Why drag and drop doesnot work with my code:
<toolkitDrag:TreeViewDragDropTarget AllowDrop="true" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" BindingValidationError="TreeViewDragDropTarget_BindingValidationError" ItemDroppedOnSource="TreeViewDragDropTarget_ItemDroppedOnSource" ItemDroppedOnTarget="TreeVi...
I have a ListView that uses a GridView and it is bound to an observable collection. On load I populate the collection and it shows up in the UI as expected. The problem happens when I try to manipulate the ObservableCollection later on; if I call RemoveAt( n ) or Clear() on the collection I get an invalid cast exeception that can't con...
It seems not all bindings are to evaluated when printing. For example, in the code below, only the first button has content = "100", other buttons have content = "0".
var doc = new XpsDocument("test.xps",FileAccess.Write);
var writer = XpsDocument.CreateXpsDocumentWriter(doc);
var collator = writer.CreateVisualsCollator();
collator.Be...
Hello,
I often use and re-use usercontrols in my apps.
For example, if a user should enter an integer number, I have a usercontrol named "IntegerEditor", which has a label for the title, a textbox for the user input, and a label for the units (inches, seconds, etc...).
My user control already has a validation rule that I called "Integ...
I based a custom menu on some code I once received. It looks OK, but I'm going crazy over how to remove the thin black border around the entire section of menuitems?! Where is this border/padding defined?
Thanks to any WPF guru that might help me with this :)
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/p...
Is there an equivalent in WPF to the Titled Borders that exists in Java's Swing framework? Below is a link that contains a screenshot of what I am looking for, and some very poor ASCII art.
http://www.java2s.com/Code/Java/Swing-JFC/TitledBorder.htm
-------TITLE--------
| |
| |
| |
|_...
I am trying to create a TabControl which matches the style of an existing tab control I use in WinForms, and one of the features of that is that it has tab button shapes like those found in VS (slant on the left, other edges square).
I am just starting out in WPF, so maybe I'm barking up the wrong tree, but I figured I needed to get a B...
In a GirdView the text of some columns sould be aligned to the right.
To do that I create a DataTemplate, which contains a TextBlock.
Binding bd = new Binding("path");
FrameworkElementFactory tbContent = new FrameworkElementFactory(typeof(TextBlock));
tbContent.SetBinding(TextBlock.TextProperty, bd);
tbContent.SetValue(TextBlock.TextAl...
Say I have the following code:
ContentControl c = new ContentControl();
c.SetBinding (ContentControl.Content, new Binding());
c.DataContext = "Test";
object test = c.Content;
At this point, c.Content will return null.
Is there a way to force the evaluation of the binding so that c.Content return "Test"?
...
I recently upgraded a number of projects from VS2008 to VS2010. Now I'm having an issue at design time w/ the WPF designer in Visual Studio. It throws an exception for every XAML page I open in design mode. Exceptions also throw for new brand new XAML pages.
Projects currently target .NET 3.5. If I switch to target .NET 4.0, designe...
I have a ItemsControl with a collection of objects. I wan't to be able to click the object and then get a panels with more info.
So I decided to style the DataTemplate for the items in the ItemsControl as a button and that seems to work fine. However I have no idea how to set the click event of this button in the style. It says I should...
I have two ComboBoxes as follows
<StackPanel Orientation="Horizontal" >
<ComboBox x:Name="cbxOne" Style="{StaticResource demoStyle}" >
<ComboBoxItem >One</ComboBoxItem>
<ComboBoxItem >Two</ComboBoxItem>
<ComboBoxItem >All</ComboBoxItem>
</ComboBox>
<ComboBox x:Name="cbxTwo">
<ComboBoxItem >1</ComboBoxItem>
<ComboBox...
Hi,
how could I add an image above each "Run" element in a FlowDocument. I tried by setting a background image with a vertical alignment top at each Run element. Unfortunately, it seems I cannot set the height of inline elements. Therefore, image are behind the text and not above them ...
...
Using WPF, how do I put controls in the window border, like the address bar of IE8, the play controls in Windows Media Player, and the address bar of Win. Explorer?
...
I have a WPF form with a combobox and a textbox (both are databound to an Object's property). Changing the combobox or textbox input updates the Object's property and the databinding kicks in and updates the UI. The problem is, I implemented a way to cancel the change, which works, but screws up the UI updating. If I make the change from...
Hi,
I have a code snippet in C# but unable to convert to VB.NET. I tried online converters but VS2008 always gives compile errors. Any help is greatly appreciated.
foreach (Binding knownBinding in allKnownBindings)
{
string errorMessage = ((IDataErrorInfo)this.DataContext)[knownBinding.Path.Path];
if (errorMessage != null && er...
I am trying to select text in my FlowDocumentScrollViewer.
I am able to find the TextPointer start position and end position. So I have 2 TextPointers...
TextPointer startPos;
TextPointer endPos;
Using these 2 TextPointers I am trying to select text in my FlowDocumentScrollViewer. I am doing it like this...
flowDocumentScrollVie...