I have a class model
namespace MUA.Models.Progress
{
public class PrRptModel : Base.NotifyChange
{
.........
public ObservableCollection<RptFldsModel> RptFld { get; set; }
.....
}
public class RptFldsModel : Base.NotifyChange
{
readonly static private string _defaultValue = "";
readonly static private FontFamily _fontS = new ("Segoe MDL2 Assets");
readonly static private FontFamily _fontA = new FontFamily("Segoe UI");
........
private string _painOnMovement = _defaultValue;
public string PainOnMovement
{
get { return _painOnMovement; }
set
{
_painOnMovement = CheckMinus(value);
OnPropertyChanged(nameof(PainOnMovement));
}
}
private string _rom = _defaultValue;
public string ROM
{
get { return _rom; }
set
{
_rom = value;
OnPropertyChanged(nameof(ROM));
}
}
private string _myoTriggerPts = _defaultValue;
public string MYOTriggerPts
{
get { return _myoTriggerPts; }
set
{
_myoTriggerPts = CheckMinus(value);
OnPropertyChanged(nameof(MYOTriggerPts));
}
}
private string _initialVisit = _defaultValue;
public string InitialVisit
{
get { return _initialVisit; }
set
{
_initialVisit = value;
OnPropertyChanged(nameof(InitialVisit));
}
}
....
}
I have a usercontroll
<UserControl
x:Class="MUA.Pages.Progress.UserCotrols.CCUC"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:MUA.Pages.Progress.UserCotrols"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="800" >
<StackPanel HorizontalAlignment="Center" Margin="10">
.........
<StackPanel Orientation="Horizontal" Padding="-2,56,0,0">
<RepeatButton Tag="0" Margin="-25,60,0,0"
Content="{Binding Path=rptFldsModel.InitialVisit }"
FontFamily="Segoe UI" Style="{StaticResource FEven}" Click="RBtn_ISW" >
<RepeatButton.Projection>
<PlaneProjection RotationZ="270"/>
</RepeatButton.Projection>
</RepeatButton>
<RepeatButton Tag="0" Margin="-70,60,0,0"
Content="{Binding Path=rptTemp.RptFld[Indx].LastVisit, Mode=TwoWay, UpdateSourceTrigger=LostFocus}"
FontFamily="Segoe UI" Style="{StaticResource FOdd}" Click="RBtn_ISW" >
<RepeatButton.Projection>
<PlaneProjection RotationZ="270"/>
</RepeatButton.Projection>
</RepeatButton>
........
XAML.CS
public PrRptModel rptTemp = StaticFiles.ProgressRptNew;
public static int Indx;
int indx = 1;
public PrRptModel prRptModel => DataContext as P;
public CCUC()
{
InitializeComponent();
}
the rest is private void BtnClick(object sender, RoutedEventArgs e)
Source page
<Page
x:Class="MUA.Pages.Progress.CC.AnklePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:MUA.Pages.Progress.CC"
xmlns:local1="using:MUA.Pages.Progress.UserCotrols"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<ItemsControl Padding="10" >
<TextBlock Text="CC Ankle" FontSize="16" Foreground="Red" FontWeight="Bold" HorizontalAlignment="Center" />
<local1:HeaderUC>
</local1:HeaderUC>
<local1:CCUC>
</local1:CCUC>
</ItemsControl>
</Page>
XAML.CS
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class AnklePage : Page
{
public AnklePage()
{
CCUC.Indx = 5;
this.InitializeComponent();
}
}
}
What I cannot figure out is how to set Binding Path=rptTemp.RptFld[Indx].LastVisit, Indx set so it displays the proper ROW
When I put an actual integer in place of Indx it works fine with x:Bind but not with Indx, I tried using Binding with
public static readonly DependencyProperty EStimProperty =
DependencyProperty.Register(
nameof(EStim),
typeof(string),
typeof(CCUC),
null);
public string EStim
{
get { return (string)GetValue(EStimProperty); }
set { SetValue(EStimProperty, value); }
}
<RepeatButton Tag="1,EStim" Margin="-70,60,0,0" Style="{StaticResource FEven}"
Content="{Binding Path=rptTemp.RptFld[Indx].EStimProperty, Mode=TwoWay, UpdateSourceTrigger=LostFocus}"
FontFamily="Segoe MDL2 UI" Click="RBtn_BlankUnit" >
<RepeatButton.Projection>
<PlaneProjection RotationZ= "270"/>
</RepeatButton.Projection>
</RepeatButton>
Nothing shows
I am lost as what I am doing wrong
Thanks in advance for the help
Paul