Click here to Skip to main content
15,912,932 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: Using a Grid as an ItemsPanel Pin
Ed.Poore11-Apr-08 11:50
Ed.Poore11-Apr-08 11:50 
GeneralRe: Using a Grid as an ItemsPanel Pin
Pete O'Hanlon11-Apr-08 12:18
mvePete O'Hanlon11-Apr-08 12:18 
GeneralRe: Using a Grid as an ItemsPanel Pin
Ed.Poore11-Apr-08 13:32
Ed.Poore11-Apr-08 13:32 
GeneralRe: Using a Grid as an ItemsPanel Pin
Pete O'Hanlon14-Apr-08 9:07
mvePete O'Hanlon14-Apr-08 9:07 
GeneralRe: Using a Grid as an ItemsPanel Pin
Ed.Poore14-Apr-08 9:41
Ed.Poore14-Apr-08 9:41 
GeneralRe: Using a Grid as an ItemsPanel Pin
Pete O'Hanlon14-Apr-08 9:54
mvePete O'Hanlon14-Apr-08 9:54 
GeneralRe: Using a Grid as an ItemsPanel Pin
Ed.Poore14-Apr-08 10:48
Ed.Poore14-Apr-08 10:48 
GeneralRe: Using a Grid as an ItemsPanel Pin
Pete O'Hanlon14-Apr-08 11:11
mvePete O'Hanlon14-Apr-08 11:11 
The problem that you have is that you are returning the wrong type of value here. I've just been playing around with a sample of this, and here's a converter sample that you might want to take a look at:
[ValueConversion(typeof(DateTime), typeof(int))]
public class ColDateFormatter : IValueConverter
{
    #region IValueConverter Members

    public object Convert(object value, Type targetType, 
        object parameter, System.Globalization.CultureInfo culture)
    {
        DateTime startDate = DateTime.Today; // This is just a test to get a date to compare to.
        TimeSpan off = startDate.Subtract(DateTime.Parse(value as string));

        return off.Days + 1;
    }

    public object ConvertBack(object value, Type targetType, object parameter,
        System.Globalization.CultureInfo culture)
    {
        throw new NotImplementedException();
    }

    #endregion
}
Here's a sample of the XAML that you'll need:
<TextBlock Grid.Row="0" Padding="2" 
           Grid.Column="{Binding XPath=Start, Converter={StaticResource ColDateFormatter}}" 
           Text="{Binding Mode=OneWay, XPath=Start, Converter={StaticResource Formatter}, ConverterParameter='dd-MMM-yy'}"/>
Obviously, you'll need to have added an appropriate number of RowDefinition and ColumnDefinition items. Hmmm. I'm almost tempted to turn this into an article. Big Grin | :-D


Deja View - the feeling that you've seen this post before.

My blog | My articles



GeneralRe: Using a Grid as an ItemsPanel Pin
Ed.Poore14-Apr-08 11:57
Ed.Poore14-Apr-08 11:57 
GeneralRe: Using a Grid as an ItemsPanel Pin
Pete O'Hanlon14-Apr-08 12:02
mvePete O'Hanlon14-Apr-08 12:02 
GeneralRe: Using a Grid as an ItemsPanel Pin
Ed.Poore14-Apr-08 12:12
Ed.Poore14-Apr-08 12:12 
GeneralRe: Using a Grid as an ItemsPanel Pin
Ed.Poore17-Apr-08 12:07
Ed.Poore17-Apr-08 12:07 
GeneralRe: Using a Grid as an ItemsPanel Pin
Pete O'Hanlon17-Apr-08 23:12
mvePete O'Hanlon17-Apr-08 23:12 
GeneralRe: Using a Grid as an ItemsPanel Pin
Ed.Poore17-Apr-08 23:20
Ed.Poore17-Apr-08 23:20 
GeneralRe: Using a Grid as an ItemsPanel Pin
Pete O'Hanlon18-Apr-08 4:21
mvePete O'Hanlon18-Apr-08 4:21 
GeneralRe: Using a Grid as an ItemsPanel Pin
Ed.Poore18-Apr-08 4:29
Ed.Poore18-Apr-08 4:29 
QuestionHow to add multiple column in a single column of gridview in WPF? Pin
bankey10108-Apr-08 21:42
bankey10108-Apr-08 21:42 
AnswerRe: How to add multiple column in a single column of gridview in WPF? Pin
Pete O'Hanlon9-Apr-08 2:44
mvePete O'Hanlon9-Apr-08 2:44 
GeneralRe: How to add multiple column in a single column of gridview in WPF? Pin
User 2710099-Apr-08 3:24
User 2710099-Apr-08 3:24 
GeneralRe: How to add multiple column in a single column of gridview in WPF? Pin
Pete O'Hanlon9-Apr-08 3:31
mvePete O'Hanlon9-Apr-08 3:31 
GeneralRe: How to add multiple column in a single column of gridview in WPF? Pin
User 2710099-Apr-08 3:39
User 2710099-Apr-08 3:39 
QuestionFlipping Image? [modified] Pin
KBou8-Apr-08 1:41
KBou8-Apr-08 1:41 
GeneralRe: Flipping Image? Pin
Pete O'Hanlon8-Apr-08 1:48
mvePete O'Hanlon8-Apr-08 1:48 
GeneralRe: Flipping Image? Pin
KBou8-Apr-08 2:03
KBou8-Apr-08 2:03 
GeneralRe: Flipping Image? Pin
Pete O'Hanlon8-Apr-08 2:31
mvePete O'Hanlon8-Apr-08 2:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.