GridViewColumn DataTemplate
-
I am working in the latest preview of blend 2 and i am getting an error that i can't seem to figure out. I have a data template for a gridview column and i am the following error: Mapping URI 'clr-namespace:Ups_Trak_System;assembly=Ups Trak System' is not valid. However, in visual studio it compiles fine w/o any errors. When i take out the Foreground attribute the error goes away so i'm thinking that it somehow can't find the "BrushConverter". Could someone please take a look at this Image[^] of the markup and see if i am doing it right? i would have just posted the markup but when i previewed it it wouldn't display correctly.
Don't be overcome by evil, but overcome evil with good
-
I am working in the latest preview of blend 2 and i am getting an error that i can't seem to figure out. I have a data template for a gridview column and i am the following error: Mapping URI 'clr-namespace:Ups_Trak_System;assembly=Ups Trak System' is not valid. However, in visual studio it compiles fine w/o any errors. When i take out the Foreground attribute the error goes away so i'm thinking that it somehow can't find the "BrushConverter". Could someone please take a look at this Image[^] of the markup and see if i am doing it right? i would have just posted the markup but when i previewed it it wouldn't display correctly.
Don't be overcome by evil, but overcome evil with good
I noticed that you're setting the Path to "*". Any reason you not setting the Path to a DependencyProperty name?
Cheers, Karl
My Blog | Mole's Home Page | How To Create Screen Capture Videos For Your ArticlesJust a grain of sand on the worlds beaches.
-
I noticed that you're setting the Path to "*". Any reason you not setting the Path to a DependencyProperty name?
Cheers, Karl
My Blog | Mole's Home Page | How To Create Screen Capture Videos For Your ArticlesJust a grain of sand on the worlds beaches.
Hey Karl (btw mole rocks!), When determining the foreground color i have to look at a couple properties of the object that i am binding to the listview. I found that adding 'Path=.' or 'Path=*' will pass the entire object to the converter class. Just to be sure, I tried it with 'Path=Status' but it didn't resolve the issue.
Don't be overcome by evil, but overcome evil with good
-
Hey Karl (btw mole rocks!), When determining the foreground color i have to look at a couple properties of the object that i am binding to the listview. I found that adding 'Path=.' or 'Path=*' will pass the entire object to the converter class. Just to be sure, I tried it with 'Path=Status' but it didn't resolve the issue.
Don't be overcome by evil, but overcome evil with good
Thanks for the comments on Mole, really appreciate them. I just learned more about the WPF Path statement too, thanks! :cool: Can you posted your XAML and Converter code here or just make a screen shot and provide a link so that I can see everything in context. I'm out for about 2 hours but will get back to you when I return.
Cheers, Karl
My Blog | Mole's Home Page | How To Create Screen Capture Videos For Your ArticlesJust a grain of sand on the worlds beaches.
-
Thanks for the comments on Mole, really appreciate them. I just learned more about the WPF Path statement too, thanks! :cool: Can you posted your XAML and Converter code here or just make a screen shot and provide a link so that I can see everything in context. I'm out for about 2 hours but will get back to you when I return.
Cheers, Karl
My Blog | Mole's Home Page | How To Create Screen Capture Videos For Your ArticlesJust a grain of sand on the worlds beaches.
Here you go (thanks again).
using System;
using System.Windows.Media;
using System.Windows.Data;namespace Ups_Trak_System
{
public class BrushConverter : IValueConverter
{
#region IValueConverter Memberspublic object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { SalesAssociate associate = value as SalesAssociate; if (associate == null) return Brushes.Black; if (associate.Status.Contains("WITH")) return Brushes.DarkGreen; else if (associate.Status.Contains("LUNCH")) return Brushes.Blue; else if (associate.Status.Contains("GUEST")) return Brushes.DarkOrange; else if (associate.Status.Contains("OFF") && !String.IsNullOrEmpty(associate.ClockOut)) return Brushes.DarkRed; return Brushes.Black; } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { throw new NotImplementedException(); } #endregion }
}
Don't be overcome by evil, but overcome evil with good
-
Here you go (thanks again).
using System;
using System.Windows.Media;
using System.Windows.Data;namespace Ups_Trak_System
{
public class BrushConverter : IValueConverter
{
#region IValueConverter Memberspublic object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { SalesAssociate associate = value as SalesAssociate; if (associate == null) return Brushes.Black; if (associate.Status.Contains("WITH")) return Brushes.DarkGreen; else if (associate.Status.Contains("LUNCH")) return Brushes.Blue; else if (associate.Status.Contains("GUEST")) return Brushes.DarkOrange; else if (associate.Status.Contains("OFF") && !String.IsNullOrEmpty(associate.ClockOut)) return Brushes.DarkRed; return Brushes.Black; } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { throw new NotImplementedException(); } #endregion }
}
Don't be overcome by evil, but overcome evil with good
Can you post the XAML code too.
Cheers, Karl
My Blog | Mole's Home Page | How To Create Screen Capture Videos For Your ArticlesJust a grain of sand on the worlds beaches.
-
Can you post the XAML code too.
Cheers, Karl
My Blog | Mole's Home Page | How To Create Screen Capture Videos For Your ArticlesJust a grain of sand on the worlds beaches.
-
I have built a C# project just like yours and it is working here. Didn't have any issues. What is the exact message you are getting from the Blend?
Cheers, Karl
My Blog | Mole's Home Page | How To Create Screen Capture Videos For Your ArticlesJust a grain of sand on the worlds beaches.
-
I have built a C# project just like yours and it is working here. Didn't have any issues. What is the exact message you are getting from the Blend?
Cheers, Karl
My Blog | Mole's Home Page | How To Create Screen Capture Videos For Your ArticlesJust a grain of sand on the worlds beaches.
Here[^] Is the error message i am getting in blend. If you see the xaml screenshot posted earlier you'll see where the errors are. However, the DataTemplate does actually work and build. but with these errors i can't go rightclick on the listview and edit the other templates or styles.
Don't be overcome by evil, but overcome evil with good
-
Here[^] Is the error message i am getting in blend. If you see the xaml screenshot posted earlier you'll see where the errors are. However, the DataTemplate does actually work and build. but with these errors i can't go rightclick on the listview and edit the other templates or styles.
Don't be overcome by evil, but overcome evil with good
I see what's up. Your assembly name is, "Ups Trak System" Your namespace is, "Ups_Trak_System" What is the name of your output .dll? Suggestion. Name your assembly and name space either, "UpsTrakSystem" or "Ups_Trak_System" This may be where Blend is all confused.
Cheers, Karl
My Blog | Mole's Home Page | How To Create Screen Capture Videos For Your ArticlesJust a grain of sand on the worlds beaches.
-
I see what's up. Your assembly name is, "Ups Trak System" Your namespace is, "Ups_Trak_System" What is the name of your output .dll? Suggestion. Name your assembly and name space either, "UpsTrakSystem" or "Ups_Trak_System" This may be where Blend is all confused.
Cheers, Karl
My Blog | Mole's Home Page | How To Create Screen Capture Videos For Your ArticlesJust a grain of sand on the worlds beaches.
Karl, you are the man! I changed the assembly to "Ups", recompiled it, and opened it in blend and it displayed the listviews correctly w/ no errors. Blend doesn't like spaces in the assembly name. Thank you so much for your help i would have never figured it out!
Don't be overcome by evil, but overcome evil with good
-
Karl, you are the man! I changed the assembly to "Ups", recompiled it, and opened it in blend and it displayed the listviews correctly w/ no errors. Blend doesn't like spaces in the assembly name. Thank you so much for your help i would have never figured it out!
Don't be overcome by evil, but overcome evil with good
Cool. I'm glad we got this sorted out. :cool:
teejayem wrote:
Don't be overcome by evil, but overcome evil with good
Love this too. Have a great day,
Cheers, Karl
My Blog | Mole's Home Page | How To Create Screen Capture Videos For Your ArticlesJust a grain of sand on the worlds beaches.