|
Ian,
Adding this did the trick: "Does the Product class implement the INotifyPropertyChanged interface?"
Thank you very much for your help.
|
|
|
|
|
I have an application where I would like a treeview to behave like a tabcontrol. What I mean is that when the user clicks on a item in the treeview, to the right would appear something sort of like what you might see in Outlook. I am trying to avoid a tabcontrol simply because there will be lot's of tabs and the items have a hierarchy to them. For example There will be companies with adresses. Each company could have multiple addresses and I would like to have a treeview item of "addresses" and then each address will have a nickname like "main address" or "billing address" and I would like for the user to be able to click on this and then see it to the right. I was thinking of maybe using multiple grids and then showing and hiding but seems that that's not in the spirit of wpf and I don't know if it will even work.
|
|
|
|
|
I do something like this in one of my applications...
There are several ways to go about this, but I do mine with a DataTemplateSelector. Basically, my content pane is just a ContentControl (Actually, I think I'm using a Label, but I forget why), with its content bound to the selected item in the tree.
The DataTemplateSelector looks at the data object being displayed, and chooses which DataTemplate to use to display it (I have one for each type of item in the tree). The individual DataTemplates are just resources with standard names, so the selector code is just returning FindResource("DT_Something") as DataTemplate
|
|
|
|
|
I'm trying to implement this BoolToVisibility converter (answer #4)
http://stackoverflow.com/questions/3128023/wpf-booleantovisibilityconverter-that-converts-to-hidden-instead-of-collapsed-whe[^]
So I added the class:
namespace Abtech.Spares.UI.Classes
{
[ValueConversion(typeof(bool), typeof(Visibility))]
public sealed class BoolToVisibilityConverter : IValueConverter
{
public Visibility TrueValue { get; set; }
public Visibility FalseValue { get; set; }
public BoolToVisibilityConverter()
{
TrueValue = Visibility.Visible;
FalseValue = Visibility.Collapsed;
}
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (!(value is bool))
return null;
return (bool)value ? TrueValue : FalseValue;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
if (Equals(value, TrueValue))
return true;
if (Equals(value, FalseValue))
return false;
return null;
}
}
}
Then in the XAML I have
<UserControl x:Class="Abtech.Spares.UI.Views.ChildContentView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Abtech.Spares.UI.Classes;assembly=Abtech.Spares.UI"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="300">
<UserControl.Resources>
<local:BoolToVisibilityConverter
x:Key="BoolToHiddenConverter"
TrueValue="Visible"
FalseValue="Hidden" />
</UserControl.Resources>
<Grid>
.
.
.
.
and I'm getting a compilation error
Abtech.Spares.UI The tag 'BoolToVisibilityConverter' does not exist in XML namespace 'clr-namespace:Abtech.Spares.UI.Classes;assembly=Abtech.Spares.UI'. Line 13 Position 10.
You can see all the namespaces/references are correct. I don't see why this isn't working.
Anyone?
Everything makes sense in someone's mind
|
|
|
|
|
Well, can't give a definitive answer, but some possibles:
1) Maybe the Abtech.Spares.UI assembly didn't compile (Are there other errors that need to be fixed first?), in which case it's still trying to link to the previous version, which didn't have the new class.
2) If that XAML is in the same assembly as the converter, you don't need the ;assembly= part of the namespace reference. Try taking that part out, as namespace references can be a little picky.
3) Try doing a Clean + Rebuild, to make sure the assembly is compiling properly.
|
|
|
|
|
# 2 was the answer. I removed the assembly name and all works fine now.
Thank you!
Everything makes sense in someone's mind
|
|
|
|
|
|
|
Nice!
|
|
|
|
|
Hi,
I have a datagrid(using WPF) and miltiple row selection is allowed. How to get multiple selected items in MVVM pattern?
It is easy to get this in code behind file? But in MVVM pattern codebehind file doesn't contains the much code.
Many thanks.
|
|
|
|
|
There are two parts to this answer. The first part is that you should use a Command to set an IsSelected property on each item in your collection. The second part compensates for the fact you can't bind to a command on the Selected event. To get round this you need to use an EventToCommand Blend Behaviour. Laurent Bugnion has a fine sample in MVVM Light.
|
|
|
|
|
thanks..Can I have that link? I couldn't get it.
|
|
|
|
|
|
I have a table MyTable (comId, groupId, versionId) that is bound to a grid using code.
The default connection generated by domain services works fine
return this.ObjectContext.MyTable;
but I modified the return statement to get one column only
return this.ObjectContext.MyTable.Include("groupId");
This statement compiles correct but returns an error
unhandle error
Manage Runtime
System.ServiceMode.DomainService.Client.DomainOperation Exception
Any help is greatly appreciated
|
|
|
|
|
You may want to post this in the LINQ forum instead rather than randomly choosing one.
|
|
|
|
|
|
As this is related to an article, you should ask on the forum for that article. It's extremely unlikely that the author will happen to wander by this forum and pick up your question.
|
|
|
|
|
I have a partial class to extend my entity framework edmx, it looks like this (in brief)"
public partial class Property
{
private string _displayAddress;
public string DisplayAddress
{
get
{
string address = number.ToString();
if (!String.IsNullOrEmpty(direction))
address += " " + direction;
address += " " + street;
if (suffixId != null)
address += " " + StreetSuffix.name;
if (!String.IsNullOrEmpty(unit))
address += " " + unit;
return address;
}
set { _displayAddress = value; }
}
}
The kicker is that the StreetSuffix is a separate table that is joined to the property table by virtue of suffixId.
The data service class has this: return this.ObjectContext.Properties.Include("StreetSuffix"); .
The metadata class has this:
[Include]
public StreetSuffix StreetSuffix { get; set; }
So what is amiss that is throwing a null error when it tries to process the StreetSuffix.name?
Cheers, --EA
|
|
|
|
|
Ahem. Wrong forum. Try the Linq forum instead.
|
|
|
|
|
I overlooked that forum for some reason, probably cosmic radiation on my brain. Thank you for your patient response.
Cheers, --EA
|
|
|
|
|
No problem, but if you got hit by cosmic radiation, does this mean you've developed cool superpowers?
|
|
|
|
|
Only if male pattern baldness and steady memory loss are considered super powers.
|
|
|
|
|
Hi can anyone tell me how to convert this array class object into normal class object, because it is not showing any method like listbox.move or listbox.remove in a listbox associated with this class object//
public partial class Directive : DependencyObject
{
public static readonly DependencyProperty DirectiveIDProperty = DependencyProperty.Register("DirectiveID", typeof(string),
typeof(Directive));
public static readonly DependencyProperty DirectiveNameProperty = DependencyProperty.Register("DirectiveName", typeof(string),
typeof(Directive));
public static readonly DependencyProperty DirectiveDescriptionProperty = DependencyProperty.Register("DirectiveDescription", typeof(string),
typeof(Directive));
public static readonly DependencyProperty PriorityProperty = DependencyProperty.Register("Priority", typeof(string),
typeof(Directive));
public static readonly DependencyProperty DefaultProperty = DependencyProperty.Register("Default", typeof(string),
typeof(Directive));
public static readonly DependencyProperty SetValueTypeProperty = DependencyProperty.Register("SetValueType", typeof(SetValueType),
typeof(Directive));
public static readonly DependencyProperty ConditionProperty = DependencyProperty.Register("Condition", typeof(Condition[]),
typeof(Directive));
public static readonly DependencyProperty GroupProperty = DependencyProperty.Register("Group", typeof(Group[]),
typeof(Directive));
}
because i was using listdata.move and listdata.remove method with normal class object, where listdata is a itemsource name..
here am not finding any method like this, so can u tell me how can i convert this classarray into normal class type..
|
|
|
|
|
I ve no idea what you are talking about. This is a DependencyObject, not an array. What array are you talking about?
|
|
|
|
|
sorry,
My mistake,
Previously i was able to delete the data from listbox Itemsource, which is getting the data from the object of this class..
Now the class structure has been changed, now the itemsource not contaiin a method like remove, move..
it is taking the value into array associated with this class, so can u tell me how can i delete the object values from this class which it contain..
|
|
|
|