Let $(X,\mathcal{X})$ and $(Y,\mathcal{Y})$ be measurable spaces and let $\mathcal{Z}$ be the product $\sigma$-algebra on $X\times Y$. Suppose $A\subset X\times Y$ is such that its $X$- and $Y$-sections are measurable w.r.t. their respective $\sigma$-algebras.
Question: Under what natural assumptions on $(X,\mathcal{X})$ and $(Y,\mathcal{Y})$ can we conclude that $A\in\mathcal{Z}$?
For example, does $\mathcal{X}=2^X$ suffice? What if we add the condition that $Y=\{0,1\}^X$, and $\mathcal{Y}$ is the cylindrical $\sigma$-algebra?