|
One of the wonderful thing about WPF is that Command properties can bind to any class that implements ICommand. Typical examples are Josh Smith's RelayCommand or PRISMs DelegateCommand. Suppose that you have RelayCommand, then you would hook it up like this:
private RelayCommand selectionToggleCommand;
public RelayCommand SelectionToggleCommand
{
get
{
if (selectionToggleCommand == null)
{
selectionToggleCommand = new RelayCommand(SelectToggle, CanSelectToggle);
}
return selectionToggleCommand;
}
}
private void SelectToggle(object o)
{
}
private bool CanSelectToggle(object o)
{
return true;
}
|
|
|
|
|
I get that much. The problem is that my XAML is in a data template and the message I get says it can't find the command on my data model.
So I need to tell my code to look on the data context, not the model.
Everything makes sense in someone's mind
|
|
|
|
|
Without knowing how and where your DataTemplate is linked in, I can't offer too much other than to say you really need to look at using a RelativeSource to find the element you are interested in to get the DataContext from.
|
|
|
|
|
i need good website to learn silverlight3.0 can anyone suggests me?
|
|
|
|
|
|
just i wanna learn about silverlight3.0 so, i need your suggestion..
|
|
|
|
|
Why do you want to learn Silverlight 3? It's at version 5 now, and it's way ahead in terms of functionality.
|
|
|
|
|
actually i just need to know all the difference between silverlight versions thats why? i knew about earlier versions..
|
|
|
|
|
If you are very new to the language, going through a book would be a better bet.
|
|
|
|
|
Hi All,
I need C1Flexgrid for WPF to be used as a usercontrol in my windows application project. I tried to do by inheriting the C1Flexgrid for WPF, but created user control is not listing in the toolbox. When I inherited normal DataGrid, its working fine. Can anyone help me out from this problem.
Thanks and Regards
Greeshma
|
|
|
|
|
I am thinking of doing an article on Silverlight treeview (I know done to death but I like to think I have an interesting take on the design) and was thinking of the bits required. I would probably use AdventureWorks for the data. Now here is the stray thought!
WCF services are pretty much a no brainer, especially if you only want to supply select functionality, so why does Microsoft not set up a public WCF to service all the demo/article/sample requirement for AdventureWorks. Allow anyone to get a List<> of any table or view in the database.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
|
Thank you, presumably this is exactly what I was looking for, a WCF of the AdventureWorks data.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi, I am using the following code below to save and load the changes a user makes to shapes on a canvas (called 'myCanvas'). So I use the XamlWriter to save the entire Canvas to a file and the XamlReader to read. The XamlWriter writes appropriately but after calling the XamlReader the Canvas does not update with the saved content.
Am I missing a step?
private void Window_Loaded(object sender, RoutedEventArgs e)
{
FileStream fs = new FileStream("savedproperties.xml", FileMode.Open);
myCanvas = (Canvas)XamlReader.Load(fs);
}
private void Window_Closed(object sender, EventArgs e)
{
FileStream fs = new FileStream("savedproperties.xml", FileMode.Create);
XamlWriter.Save(myCanvas, fs);
}
|
|
|
|
|
Please how can I Fill a shape with horizontal or vertical lines only.
|
|
|
|
|
|
Thanks for your suggestion, Abhinav, though it didn't really help. But I guess that's because I still need to understand some graphics/wpf basics.
|
|
|
|
|
In my view model I have:
private void loadUserSettings()
{
OptionsAreaExpanded = Properties.Settings.Default.OptionsAreaExpanded;
ShowActiveContactsOnly = Properties.Settings.Default.ActiveContactsOnly;
}
private void saveUserSettings()
{
Properties.Settings.Default.OptionsAreaExpanded = OptionsAreaExpanded;
Properties.Settings.Default.ActiveContactsOnly = ShowActiveContactsOnly;
Properties.Settings.Default.Save();
}
The loadUserSettings method is called from the CTOR. Where's the right place to call saveUserSettings from.
Everything makes sense in someone's mind
|
|
|
|
|
In winforms there is an onclosing, I wonder if there is the same on a view. I used that in this article[^].
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I'd like to create this[^] blue area on a window.
I'm thinking a border to start with, but as far as the gradient, I'm not sure how to do that.
Any suggestions?
Everything makes sense in someone's mind
|
|
|
|
|
Heres a thought, why don't you download the source code from the example and chase through the style/xaml. Assuming of course that Karl has not supplied it as a theme.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Look at the XAML sections headed LinearGradientBrush .
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Hello,
I have an object with 3 properties- Field, Value, Operator. Also i have a list of this objects.
In my DataGrid i have an operator column which is static.
All other columns are added dynamically using dependency properties (adding column from the object - using Field Attribute).
The same object contains the value so the value will be presented in the cell under the right column (Field) .
All objects that have the same operator will be presented in one row in the DataGrid.
How can i do it? How do i use Dependency properties for this (if i need)?
|
|
|
|
|
|
While creating style for a button I am writing like this:
<Style x:Key="MagButtonStyle" TargetType="{x:Type Button}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Grid>
<Image Name="Normal" Source="Resources/Images/n0.png"/>
<Image Name="RollOver1" Source="Resources/Images/r1.png" Visibility="Hidden"/>
<Image Name="RollOver2" Source="Resources/Images/r2.png" Visibility="Hidden"/>
<Image Name="RollOver3" Source="Resources/Images/r3.png" Visibility="Hidden"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Normal" Property="Visibility" Value="Hidden"/>
<Setter TargetName="RollOver1" Property="Visibility" Value="Visible"/>
</Trigger>
</Style>
Can we control this trigger by some global variable/ dependency property defined in c# code? So, we would be able to use it with Multi-trigger?
Basically my requirement is to display different images based on property "DepProp". I need to be able to wrtite something like this:
<Trigger Property="DepProp" Value="1">
<Setter TargetName="RollOver1" Property="Visibility" Value="Visible"/>
</Trigger>
<Trigger Property="DepProp" Value="2">
<Setter TargetName="RollOver2" Property="Visibility" Value="Visible"/>
</Trigger>
Is it possible?
Other way around would be to access these style objects on mouseenter in c# code. Possible? If yes, how?
Which way will be better?
|
|
|
|