Click here to Skip to main content
15,887,267 members
Home / Discussions / WPF
   

WPF

 
QuestionWPF Programmatically Adding Control To Grid - Wire Event Pin
Kevin Marois16-Dec-14 13:02
professionalKevin Marois16-Dec-14 13:02 
AnswerRe: WPF Programmatically Adding Control To Grid - Wire Event Pin
Richard MacCutchan16-Dec-14 21:39
mveRichard MacCutchan16-Dec-14 21:39 
GeneralRe: WPF Programmatically Adding Control To Grid - Wire Event Pin
Kevin Marois17-Dec-14 5:49
professionalKevin Marois17-Dec-14 5:49 
GeneralRe: WPF Programmatically Adding Control To Grid - Wire Event Pin
Richard MacCutchan17-Dec-14 6:26
mveRichard MacCutchan17-Dec-14 6:26 
GeneralRe: WPF Programmatically Adding Control To Grid - Wire Event Pin
Kevin Marois17-Dec-14 6:29
professionalKevin Marois17-Dec-14 6:29 
QuestionLinearGradientBrush issue Pin
SledgeHammer0115-Dec-14 7:37
SledgeHammer0115-Dec-14 7:37 
AnswerRe: LinearGradientBrush issue Pin
Mycroft Holmes16-Dec-14 13:55
professionalMycroft Holmes16-Dec-14 13:55 
QuestionUnable to Load viewmodel onto xamoutlookbar(Silverlight). Pin
micromortu11-Dec-14 9:34
micromortu11-Dec-14 9:34 
Hi Guys,

I have a view model with code below.
C#
using System.Collections.ObjectModel;
using System.ComponentModel;
//using ChurchWX.Classes;

namespace ChurchWX
{
    public class ViewModel : INotifyPropertyChanged
    {
        private ObservableCollection<Group> _groups;
        public ObservableCollection<Group> Groups
        {
            get { return _groups; }
            set
            {
                _groups = value;
                OnPropertyChanged("Groups");
            }
        }

        public ViewModel()
        {
            Groups = GenerateGroups();
        }

        private ObservableCollection<Group> GenerateGroups()
        {
            ObservableCollection<Group> groups = new ObservableCollection<Group>();

            //create the mail group with menu items
            var mailGroup = new Group() { Title = "Mail",
                LargeImagePath = @"/XamOutlookBarDataBinding;component/Images/Mail32.png", 
                SmallImagePath = @"/XamOutlookBarDataBinding;component/Images/Mail16.png" };
            var rootMailItem = new MenuItem() { Title = "Personal Folders", IsExpanded = true };
            rootMailItem.Children.Add(new MenuItem() { Title = "Inbox", ImagePath = @"/XamOutlookBarDataBinding;component/Images/InboxFolder16.png" });
            rootMailItem.Children.Add(new MenuItem() { Title = "Drafts", ImagePath = @"/XamOutlookBarDataBinding;component/Images/DraftsFolder16.png" });
            rootMailItem.Children.Add(new MenuItem() { Title = "Sent Items", ImagePath = @"/XamOutlookBarDataBinding;component/Images/SentFolder16.png" });
            rootMailItem.Children.Add(new MenuItem() { Title = "Deleted Items", ImagePath = @"/XamOutlookBarDataBinding;component/Images/DeletedFolder16.png" });
            mailGroup.Items.Add(rootMailItem);

            //create the contacts group with menu items
            var contactsGroup = new Group() { Title = "Contacts", 
                LargeImagePath = @"/XamOutlookBarDataBinding;component/Images/Contact32.png", 
                SmallImagePath = @"/XamOutlookBarDataBinding;component/Images/Contact16.png" };
            var rootContactItem = new MenuItem() { Title = "My Contacts", IsExpanded = true };
            rootContactItem.Children.Add(new MenuItem() { Title = "Suggested Contacts", ImagePath = @"/XamOutlookBarDataBinding;component/Images/Contact16.png" });
            rootContactItem.Children.Add(new MenuItem() { Title = "Contacts" , ImagePath = @"/XamOutlookBarDataBinding;component/Images/Contact16.png" });
            contactsGroup.Items.Add(rootContactItem);

            groups.Add(mailGroup);
            groups.Add(contactsGroup);

            return groups;
        }

        public event PropertyChangedEventHandler PropertyChanged;
        protected void OnPropertyChanged(string propertyname)
        {
            var handler = PropertyChanged;
            if (handler != null)
                handler(this, new PropertyChangedEventArgs(propertyname));
        }
    }
}



I also have the XAML below to display display the content defined in the viewmodel.

XAML
<UserControl xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"  x:Class="ChurchWX.MainPage"
    xmlns:local="clr-namespace:ChurchWX"
    xmlns:D="clr-namespace:ChurchWX.Classes"
    xmlns:ig="http://schemas.infragistics.com/xaml" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk">

    <UserControl.DataContext>
        <local:ViewModel/>
    </UserControl.DataContext>
    
        
    
    <UserControl.Resources>
        <Style TargetType="ig:OutlookBarGroup">   
            <Setter Property="Header" Value="{Binding Title}"/>
            <Setter Property="LargeIconTemplate"  Value="{Binding LargeImagePath}"/>
            <Setter Property="SmallIconTemplate" Value="{Binding SmallImagePath}"/>
            <Setter Property="Content" Value="{Binding Items}" />
            <Setter Property="ContentTemplate">
                <Setter.Value>
                    <DataTemplate >
                        <ig:XamDataTree ItemsSource="{Binding}">
                            <ig:XamDataTree.GlobalNodeLayouts>
                                <ig:NodeLayout Key="ItemsLayout" TargetTypeName="MenuItem" DisplayMemberPath="Title" IsExpandedMemberPath="IsExpanded">
                                    <ig:NodeLayout.CollapsedIconTemplate>
                                        <DataTemplate>
                                            <Image Source="{Binding Data.ImagePath}" />
                                        </DataTemplate>
                                    </ig:NodeLayout.CollapsedIconTemplate>
                                </ig:NodeLayout>
                            </ig:XamDataTree.GlobalNodeLayouts>                            
                        </ig:XamDataTree>
                    </DataTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>

    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Border x:Name="brTop" Grid.Row="0" BorderBrush="White" BorderThickness="0,0,0,1" Height="30">
            <Border.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="White" Offset="0.299"/>
                    <GradientStop Color="#FFC1C9CD" Offset="0.979"/>
                </LinearGradientBrush>
            </Border.Background>
            <TextBlock Margin="12,0,0,0" Text="Church Works v1.0.0" FontSize="12" 
				VerticalAlignment="Center" HorizontalAlignment="Left" FontWeight="Bold">
				<TextBlock.Effect>
					<DropShadowEffect Color="White" BlurRadius="1" ShadowDepth="1"/>
				</TextBlock.Effect>
				<TextBlock.Foreground>
					<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
						<GradientStop Color="#FFB292DA"/>
						<GradientStop Color="#FF292929" Offset="1"/>
					</LinearGradientBrush>
				</TextBlock.Foreground>
            </TextBlock>
        </Border>
        <Grid x:Name="MainPageLayoutRoot" Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"  MinWidth="60" />
                <ColumnDefinition Width="4"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Canvas x:Name="propertyCanvas" Grid.Column="2"></Canvas>
            <StackPanel Name="stpOutlookBar" Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="150">
                <ig:XamOutlookBar GroupsSource="{Binding Groups}"/>
            </StackPanel>
            <sdk:GridSplitter Grid.Column="1" HorizontalAlignment="Left" Grid.RowSpan="2" Background="#FFBACBFF"/>
            <StackPanel Grid.Column="2" Width="800">                
                <Grid x:Name="WorkAreaLayoutRoot" Background="White" Grid.Column="2">
                    
                </Grid>
            </StackPanel>
            
        </Grid>

        
    </Grid>


</UserControl>


the xamOutlookbar only displays ChurchWX.Groups on the two groups defined.

I will be glad is someone will direct me as to where I went wrong.

Thank you
QuestionHide Controls In Assembly Pin
Kevin Marois10-Dec-14 15:41
professionalKevin Marois10-Dec-14 15:41 
QuestionUnable to modify and add records in Lightswitch Editable Grid Pin
sumB8-Dec-14 22:55
sumB8-Dec-14 22:55 
QuestionWPF DataGrid Add DataGridTemplateColumn At RunTime Pin
Kevin Marois26-Nov-14 13:02
professionalKevin Marois26-Nov-14 13:02 
AnswerRe: WPF DataGrid Add DataGridTemplateColumn At RunTime Pin
ferragus26-Nov-14 16:54
professionalferragus26-Nov-14 16:54 
Question"Smoothing" out a PolyLine? Pin
SledgeHammer0120-Nov-14 10:17
SledgeHammer0120-Nov-14 10:17 
AnswerRe: "Smoothing" out a PolyLine? Pin
den2k8820-Nov-14 10:37
professionalden2k8820-Nov-14 10:37 
GeneralRe: "Smoothing" out a PolyLine? Pin
SledgeHammer0120-Nov-14 11:01
SledgeHammer0120-Nov-14 11:01 
GeneralRe: "Smoothing" out a PolyLine? Pin
den2k8820-Nov-14 11:07
professionalden2k8820-Nov-14 11:07 
GeneralRe: "Smoothing" out a PolyLine? Pin
SledgeHammer0120-Nov-14 11:50
SledgeHammer0120-Nov-14 11:50 
QuestionTreeView Children Loading Indicator Pin
cjb11019-Nov-14 23:27
cjb11019-Nov-14 23:27 
SuggestionRe: TreeView Children Loading Indicator Pin
Richard MacCutchan20-Nov-14 1:20
mveRichard MacCutchan20-Nov-14 1:20 
QuestionHow to navigate from one wpf window to another after certain time interval? Pin
Member 1109866018-Nov-14 23:29
Member 1109866018-Nov-14 23:29 
AnswerRe: How to navigate from one wpf window to another after certain time interval? Pin
Pete O'Hanlon18-Nov-14 23:55
mvePete O'Hanlon18-Nov-14 23:55 
GeneralRe: How to navigate from one wpf window to another after certain time interval? Pin
Member 1109866019-Nov-14 22:39
Member 1109866019-Nov-14 22:39 
GeneralRe: How to navigate from one wpf window to another after certain time interval? Pin
Pete O'Hanlon19-Nov-14 22:56
mvePete O'Hanlon19-Nov-14 22:56 
QuestionBinding to xml element that is indexed from another xml document Pin
Member 97580137-Nov-14 12:26
Member 97580137-Nov-14 12:26 
AnswerRe: Binding to xml element that is indexed from another xml document Pin
Mycroft Holmes7-Nov-14 12:58
professionalMycroft Holmes7-Nov-14 12:58 

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.