The goal:
I'm trying to achieve something like this in WPF:
An initial solution:
At the moment, I'm trying to use an ItemsControl with an ItemTemplate composed of an Expander.
I want a consistent look for the Header portion of the Expander, but I want the Content portion of the Expander to be completely flexible. So, it's basical...
The code I'm working on is part of a WPF application that should display a set of stacks of playing cards that the user can interact with. So there's three UserControls I'm working with:
MainControl
CardStackControl
CardControl
In MainControl.xaml:
<StackPanel
Grid.Row="0"
Orientation="Horizontal">
<Ite...
I can inherit and enhance the ToolBar class by creating a plain C# class, then doing this:
public class NiceToolBar : ToolBar
{
private ToolBarTray mainToolBarTray;
public NiceToolBar()
{
mainToolBarTray = new ToolBarTray();
mainToolBarTray.IsLocked = true;
this.Background = new SolidColorBrush(Colo...
My typical form with Grid look like this in XAML:
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
...
I'm trying to get the validation to not show through my custom modal dialog. I've tried setting the zindex of the dialog and and of the elements in this template. Any ideas?
This is coming from a validation template:
<ControlTemplate x:Key="ValidationTemplate">
<DockPanel>
<TextBlock Foreground="Red" FontSize="20"...
What I want is simply that all my TextBoxes as by default set their cursor at the end of the text so I want in pseudocode:
if (TextChanged) textbox.SelectionStart = textbox.Text.Length;
Because I want that all textboxes in my application are affected I want to use a style for that. This one won't work (for obvious reasons) but you get...
Hi there,
I have been getting my feet wet with MVVM pattern for WPF and everything is working as it should..
But i am wiring up the viewmodel to my view datacontext from my codebehind of my window.
Sure enough the point of MVVM is to get rid of code behind in windows... which it does great, so i am left with 2 simple lines to wire up...
I have the following style:
<Style x:Key="ActionLabelStyle" TargetType="{x:Type Label}">
<Setter Property="Margin" Value="10,3" />
<Setter Property="Padding" Value="0" />
<Setter Property="TextBlock.TextWrapping" Value="Wrap" />
<Setter Property="FontFamily" Value="Calibri" />
<Style.Triggers>
<MultiTrigger>...
As part of learning wpf I'm working through some MS 'lab' sample apps; The finished exercise looks right, but I'm hitting a NullReferenceException with "Source code unavailable" issue (exception detail below). It appears to be thrown after the main window is shown.
I suspect the issue is in the XAML, but the debugger isn't helping me a...
I am using a VisualBrush as part of a control template. I want the image to not be tiled or scaled, and the top-left corner of the target visual to be aligned to the top-left corner of the rectangle I am filling. The trouble is, without specifying absolute Viewbox units, I can't make this happen, and I can't use absolute viewbox units in...
Maybe I'm expecting too much here, but I figure I can't be the first person to have tried. Do I have to create (yet another) converter for this?
...
Lets say we have the following code in XAML (the datagrid is bound to an ObservableCollection and the column to a property of the ObservableCollection:
<WpfToolkit:DataGrid
ItemsSource="{Binding Path=Collection}"
HorizontalScrollBarVisibility="Hidden" SelectionMode="Extended"
CanUserAddRows="False" CanUserDeleteR...
Hy i'm looking for these types of learning resources.
One that is explaining the basics of
the Silverlight styling(Basic Terms).
Or some very simple collection of
examples,in wich i can learn a lot.
And one is that is very similar to Silverlight Documentation
(ex. what property do you need to set if you want have this modification),ex...
Paste this into Cider.
<Grid x:Name="Grid">
<Grid.ColumnDefinitions>
<ColumnDefinition x:Name="ColumnDefinition"/>
</Grid.ColumnDefinitions>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Text="{Binding ActualWidth, ElementName=Grid}"/>
<TextBlock Text="{Binding Actual...
hi,
I am working on NHibernate with wpf. I want to inject (insert) XAML from code behind file. for example I have a xaml grid at user interface level. Now i want to enter xaml string in xaml grid tag from code behind file. How can i achieve that?
I want dynamically insert/remove xaml from .cs file. please help.
...
I have a custom controls library, in which I defined a control template, that uses some custom styles. My control template is located in the Generic.xaml file, and the styles it uses are also located there, and accessed by the control template with the StaticResource markup extension.
In some cases, when I use this controls library, I wa...
I'm trying to add Validation to a Silverlight 3.0 TextBox but cannot seem to find and example which is complete, and not missing functionality that makes it work, I have this property:
''' <summary>Tag</summary>
''' <value>String</value>
''' <returns>String</returns>
''' <remarks>Contains Validation</remarks>
Public ...
I've created a custom control that I insert into my window with the following code
<controls:ListExpander Text="Class Diagrams"></controls:ListExpander>
The control in question contains several subcontrols, among others, a list. How can create the setup, so I can specify items that should be added to the list? Eventually I'm looking f...
I've built a custom user control which inherits ComboBox and has items which are
KeyValuePair<bool, string>
I want to set the boolean default value of this ComboBox so that when true it shows "Yes" and when false it shows "No".
In the code below, when I set the selected value to true, then the ComboBox correctly shows "Yes".
But wh...
In one project I have an Editor Class:
namespace TestXamlInherit234
{
public class CustomerEditor : BaseEditor
{
public CustomerEditor()
{
TheMessage.Text = "changed222";
}
}
}
which inherits from a WPF User Control in another project:
using System.Windows.Controls;
namespace Core
{
...