U.S. Housing and Urban Development Secretary Julian Castro and D.C. Mayor Muriel E. Bowser tour the now-pricey Shaw neighborhood Thursday to discuss affordable housing. (Katherine Frey/The Washington Post)

Mayor Muriel E. Bowser and U.S. Housing and Urban Development Secretary Julián Castro took a rainy walking tour through the Shaw neighborhood Thursday to highlight the success of public investments in affordable housing and commercial development.

But in a once-blighted neighborhood destroyed by the 1968 riots, the unanswered question that hung over their walk was whether it’s really possible to protect affordability in what is now one of the most expensive places in the District.

Bowser (D) and Castro were celebrating HUD’s 50th anniversary, and they used the occasion to point out new affordable housing projects — about 300 units in total — to a throng of media representatives.

They started at the Phyllis Wheatley YWCA building, in the 900 block of Rhode Island Avenue NW, which is being renovated using local and federal funding to produce 84 private rooms for low-income working women and for women with special needs.

They also stopped by the soon-to-be Channing Phillips apartments on Seventh Street NW. Construction started Wednesday on 56 units of affordable housing for people who make no more than 60 percent of the median income — about $65,830 in the District — between 2009 and 2013.

But some of the buildings they pointed out seemed incongruous in the newly upscale neighborhood. Half a block north, there’s a muffin shop, a cocktail bar that specializes in sherry and apartments that start at more than $2,200 a month for a one-bedroom unit.

Shaw, a historically African American community ravaged in 1968 after the assassination of the Rev. Martin Luther King Jr., has become emblematic of the often-discussed gentrification that has transformed the city in the past decade. Less clear is whether it is also a success story of how federal and local partnerships can successfully revitalize a neighborhood to serve its longtime residents.

The new government-funded projects, Bowser said, are proof that it is.

“Today, the District and HUD are ensuring that those in need have a chance to share in our recent prosperity and revitalization,” she said.

Access to affordable housing was a main tenet of Bowser’s 2014 mayoral campaign. Her proposed budget for 2016, which the D.C. Council is slated to vote on next week, allocates $100 million for housing projects. She has also proposed paying for expanded homeless services and other programs through a citywide sales tax increase, which some D.C. Council members have said they oppose.

But if Shaw wants to keep its remaining longtime residents, affordable housing must come quickly. The Shaw and Logan Circle neighborhoods, according to data from the Urban Institute, were 25 percent white in 2000. In 2010, they were 48 percent white, a share of the population that has only increased in the past five years.

“While we grow, we need more intentional policy on how to preserve affordable housing,” Bowser said after the walking tour, adding that it’s not too late for Shaw to be a neighborhood where low-income and expensive housing exist side-by-side over the long term.

The last building Bowser and Castro visited was Progression Place, a building that opened in 2013 above the Shaw Metro station in the heart of the neighborhood, along Seventh Street NW.

The large complex was funded in part by a Federal Housing Administration loan and is home to the Mockingbird Hill sherry bar, the United Negro College Fund offices and upscale apartments — some of which have been designated “affordable.”

Wanda Henderson, 59, opened a hair salon in the block in 2003. She had to close it in 2010 while construction for Progression Place was underway. Last year, with the help of some city grants, she reopened in the new complex.

“I was able to survive because I’m well known in the area,” said Henderson, who grew up in nearby LeDroit Park and now lives in Petworth. “Change is good, but I would like everyone to be able to stay here.”

Castro said the troubles vexing Shaw are no different than those persistent in urban centers throughout the country. And such D.C. neighborhoods as Bloomingdale, H Street NE, Navy Yard and Columbia Heights are enduring similar storylines as Shaw.

He said that urban cities need to offer people of modest means opportunities, like those showcased by the affordable housing units, to stay in their neighborhoods. If they can’t stay, Castro said, they need access to vouchers so they can find suitable living spaces elsewhere.

“It would be a Pyrrhic victory if the neighborhood is completely improved and the longtime residents don’t get to enjoy those improvements,” he added. “We need to strike a balance.”