2

I'm using Modern UI for my WPF project.

I have 2 questions:

  1. I have mui:ModernTab Layout="List" which means a ListCollection, and i want to bind a click on one of the Links (I guess to bind mouseleftbuttonup), is it possible? (I need it because i have the same Source xaml for all of the links).

  2. And if i can do this, is there anyway to detect what is the DisplayName of the clicked Link?

Code:

<UserControl x:Class="MyApp.Pages.Results.SecondPage"
             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:mui="http://firstfloorsoftware.com/ModernUI"
             xmlns:local="clr-namespace:MyApp.Pages.Results"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <mui:ModernTab Layout="List" Links="{Binding Path=SomeLinks}">

        </mui:ModernTab>
    </Grid>
</UserControl>

The View Model:

 class ViewModel : NotifyPropertyChanged
    {
        private Uri My_URI = new Uri("/Pages/Results/MyList.xaml", UriKind.Relative);
        private LinkCollection someLinks;
private string path = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName;

        public ResultsViewModel()
        {

            someLinks= new LinkCollection();

            add_to_list(someLinks);


        }


        public void add_to_list(LinkCollection someLinks)
        {
            XDocument xdoc = XDocument.Load(path + @"\Pages\Results\Target_XML.xml");

            List<string> names= xdoc.Elements().Elements().Elements().Select(x => x.Name.LocalName).ToList();

            foreach (string ing_name in names) 
                someLinks.Add(new Link() { DisplayName = ing_name, Source = My_URI});
        }

        public LinkCollection SomeLinks
        {
            get { return this.someLinks; }
        }
Ben
  • 201
  • 1
  • 4
  • 13

0 Answers0