A helpful way to debug HTML canvas while doing a lot of translations, transformations, and so on.
context.fillRect(0, 0, 2, 2);
This line prints a tiny rectangle at the point of zero coordinates.
Random programming things I'd want to remember
A helpful way to debug HTML canvas while doing a lot of translations, transformations, and so on.
context.fillRect(0, 0, 2, 2);
This line prints a tiny rectangle at the point of zero coordinates.
myTextBox.Foreground = new SolidColorBrush(Colors.White);
//YourViewModel.cs:
private DelegateCommand yourCommand;
public YourPageConstructor()
{
yourCommand = new DelegateCommand(this.YourMethod);
...
}
private void YourMethod(object obj)
{
...//do something here
}
public ICommand YourCommand { get { return yourCommand; } }
//yourPage.xaml.cs:
public yourPage()
{
InitializeComponent();
this.DataContext = new YourViewModel();
}
//yourPage.xaml:
<ListBox x:Name="yourDataControl" ...>
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<Button Command="{Binding YourCommand}" Content="YourItems" ... />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
//yourPage.xaml, add an x:Name attribute to the content of the opening PhoneApplicationPage tag:
<phone:PhoneApplicationPage
x:Class="YourProjectName.Views.yourPage"
x:Name="nameYourXAMLPageName"
...>
//and then change the Button's binding:
<ListBox x:Name="yourDataControl" ...>
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<Button Command="{Binding ElementName=nameYourXAMLPageName, Path=DataContext.YourCommand}"
Content="{Binding YourItems}" ... />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
...