Я сделал это сам с манипуляцией Delta, но это не совсем гладко
В атрибутах класса
x:local="clr-namespace:YourApplicationNamespace"
В XAML:
<Grid x:Name="LayoutRoot" ManipulationDelta="LayoutRoot_ManipulationDelta">
<Grid.Resources>
<local:CustomSettings x:Key="Settings"/>
<DataTemplate x:Key="verseDataTemplate">
<TextBlock FontSize="{Binding Path=Font35, Source={StaticResource Settings}}"
Text="{Binding}"/>
</DataTemplate>
</Grid.Resources>
<ListBox ItemTemplate="{StaticResource verseDataTemplate}"/>
в коде позади:
private void LayoutRoot_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
{
try
{
var fnt = lboVerses.FontSize;
if (e.DeltaManipulation.Scale.X == 0 || e.DeltaManipulation.Scale.Y == 0) return;
if (e.DeltaManipulation.Scale.X > 1 || e.DeltaManipulation.Scale.Y > 1)
{
if (fnt < 72)
BibliaSettings.font35++;
}
else if (e.DeltaManipulation.Scale.X < 1 || e.DeltaManipulation.Scale.Y < 1)
{
if (fnt > 5)
BibliaSettings.font35--;
}
}
catch (Exception x)
{
Debugger.Log(0, "Errors", x.Message + "\n" + x.StackTrace);
}
}
Ваш класс CustomSettings
public class CustomSettings : INotifyPropertyChanged
{
public static List<CustomSettings> Instances;
public CustomSettings()
{
if (Instances == null) Instances = new List<CustomSettings>();
Instances.Add(this);
}
public static int font35
{
get
{
return Get("Font35", 35); //Provide mechanism to get settings
}
set
{
Save(value, "Font35");//Provide mechanism to store settings
Instances.ForEach(inst => inst.OnPropertyChanged("Font35"));
}
}
public int Font35
{
get
{
return font35;
}
set
{
font35=value;
}
}
public event PropertyChangedEventHandler PropertyChanged;
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null)
handler(this, new PropertyChangedEventArgs(propertyName));
}
}