Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Is this the correct behaviour for a MT.D or a bug?

$
0
0

Hi,

I have a simple MT.D view. On it are two radio groups set up like this (with the events)

var advancedLog = new RadioElement(StringUtils.GetString("UserSettings.MTD.Log.Advanced"), "logging");
var basicLog = new RadioElement(StringUtils.GetString("UserSettings.MTD.Log.Basic"), "logging");
var logFunctionSettings = new Section(StringUtils.GetString("UserSettings.MTD.Log.Message"))
{ 
    advancedLog, basicLog, 
};    

advancedLog.Tapped += logTapped(true);
basicLog.Tapped += logTapped();

var textHigh = new RadioElement(StringUtils.GetString("UserSettings.MTD.Text.High"), "text");
var textMedium = new RadioElement(StringUtils.GetString("UserSettings.MTD.Text.Medium"), "text");
var textLow = new RadioElement(StringUtils.GetString("UserSettings.MTD.Text.Low"), "text");
var textRestrictSettings = new Section(StringUtils.GetString("UserSettings.MTD.Text.Message"))
{
    textHigh, textMedium, textLow,
};

textHigh.Tapped += textTapped(2);
textMedium.Tapped += textTapped(1);
textLow.Tapped += textTapped();

The root element looks like this

var mainSettings = new Section()
{
    new RootElement(StringUtils.GetString("UserSettings.MTD.Main.Text"), new RadioGroup("text", 0))
    {
        textRestrictSettings,
    },
    new RootElement(StringUtils.GetString("UserSettings.MTD.Main.Logging"), new RadioGroup("logging", 0))
    {
        logFunctionSettings,
    },
};

When the MT.D is shown, the events are fired immediately despite them not being tapped. I'm running the latest alpha version so would like to check this before filing a bug report.

The events look like this

private NSAction logTapped(bool basic = false)
{
    string title = StringUtils.GetString("UserSettings.MTD.Log.Title");
    string message = StringUtils.GetString("UserSettings.MTD.Log.Common.Message");
    string button = StringUtils.GetString("Common.OK");
    if (!basic)
        message += "\n\n" + StringUtils.GetString("UserSettings.MTD.Log.Advanced.Message1") + "\n\n" + 
                    StringUtils.GetString("UserSettings.MTD.Log.Advanced.Message2");
    UIUtils.createAlert(title, message, true, button);
    return null;
}

UIUtils.createAlert is a wrapper for UIAlert, StringUtils.GetString just grabs the string from the localisation file.

Thanks

Paul


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>