wpf - Make a button "public" in xaml and c# -
i building mobile app using xamarin platform. in solution, there core
project , platform specific projects, in case, .ios
, .android
. in core project have xaml layout, button element. my_app.core.homepage.xaml
<button x:name="loginicon" image="key.png" horizontaloptions="center" verticaloptions="centerandexpand" grid.row="9" grid.column="3" grid.columnspan="3" />
i have platform specific logic in projects, result of alter source of these buttons. e.g.
my_app.ios.customfile.cs:
my_app.homepage.loginicon.source = imagesource.fromfile("bluetoothg.png");
of course, button defined in xaml, loginicon
isn't visible file, how can make xaml element public
, can reference other projects in solution reference core files?
create property on page , return button:
public button publoginicon{ get{ return loginicon; } }
but, must wrongly designed if must access controls on page, better approach have functionality in page public function, in case have no need access controls.
Comments
Post a Comment